rename array exports, make sure Mark is exported

This commit is contained in:
Eric Rykwalder 2022-03-11 17:56:17 -05:00
parent 549860b85b
commit d81022e19b
3 changed files with 16 additions and 5 deletions

View file

@ -29,10 +29,14 @@ import { Comment, InternalLink } from "lezer-markdown-obsidian";
const parser = mdParser.configure([Comment, InternalLink]); const parser = mdParser.configure([Comment, InternalLink]);
``` ```
### `ObsidianMDExtensions` ### `Extensions`
An array of all the extensions for Obsidian's markdown syntax. An array of all the extensions for Obsidian's markdown syntax.
### `BlockAndInline`
An array of all the extensions except YAML frontmatter.
### `Comment` ### `Comment`
This adds support for parsing comments in the form of: `%%comment%%`. This adds support for parsing comments in the form of: `%%comment%%`.
@ -73,6 +77,10 @@ Internal embeds are structured like:
The `#heading` and `|display` parts are optional. Heading can be a `#^blockid` instead, and multiple headings can be chained together. The `#heading` and `|display` parts are optional. Heading can be a `#^blockid` instead, and multiple headings can be chained together.
### `Mark`
This adds support for highlight marks in the form of `==highlighted==`.
### `TaskList` ### `TaskList`
This adds support for Obsidian's task lists, which allow support for arbitrary characters for tasks. This makes it different from GFM task lists. This adds support for Obsidian's task lists, which allow support for arbitrary characters for tasks. This makes it different from GFM task lists.

View file

@ -339,7 +339,7 @@ function parseDisplay(cx: InlineContext, start: number): Element | null {
return null; return null;
} }
const MarkDelim = { resolve: "Mark", mark: "MarkMarker" }; export const MarkDelim = { resolve: "Mark", mark: "MarkMarker" };
export const Mark: MarkdownConfig = { export const Mark: MarkdownConfig = {
defineNodes: ["Mark", "MarkMarker"], defineNodes: ["Mark", "MarkMarker"],
@ -496,7 +496,7 @@ export const YAMLFrontMatter: MarkdownConfig = {
], ],
}; };
export const ObsidianMDExtensions = [ export const Extensions = [
Comment, Comment,
Footnote, Footnote,
Hashtag, Hashtag,
@ -509,4 +509,6 @@ export const ObsidianMDExtensions = [
YAMLFrontMatter, YAMLFrontMatter,
]; ];
export const parser = defParser.configure(ObsidianMDExtensions); export const BlockAndInline = Extensions.slice(0, -1);
export const parser = defParser.configure(Extensions);

View file

@ -1,10 +1,11 @@
export { export {
BlockAndInline,
Comment, Comment,
Extensions,
Footnote, Footnote,
Hashtag, Hashtag,
InternalLink, InternalLink,
Mark, Mark,
ObsidianMDExtensions,
parser, parser,
TaskList, TaskList,
Tex, Tex,