-
Question:How to disable some specific tokenizers when using Why:I want to use My current code is as below: import mdast from "mdast"
import fromMarkdown from "mdast-util-from-markdown"
function parseInlineMarkdown(text: string): mdast.PhrasingContent[] {
const root: mdast.Root = fromMarkdown(text)
if (root.children.length === 0) {
console.warn("root has not children:", root)
return []
}
const content: mdast.Content = root.children[0]
if (content.type != "paragraph") {
console.warn("root has not paragraph children:", root)
return []
}
return content.children
}The function will fail when parsing It seems that I can fix my issue by somehow disabling all block-level tokenizers (like what markdown-it does). But I'm not sure I'm in the right direction. Possible solutionsI found a third party remark plugin that can disable some tokenizers: https://github.com/zestedesavoir/zmarkdown/tree/master/packages/remark-disable-tokenizers. However, they haven't migrated to the latest remark version (with Related issues: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
We had remarkjs/remark#552 about this recently, does that help? |
Beta Was this translation helpful? Give feedback.
We had remarkjs/remark#552 about this recently, does that help?