Having troubles parsing Markdown with some plugins #164
-
Currently, I'm trying to parse Markdown with some plugins here However, ever since I split up my parsing flow into Parsing, Transforming, and Stringifying, things stopped working. None of the markdown extensions are transforming my tree. Interestingly, my rehype plugins were applied. I was wondering how I've messed something up. Before, I did everything in one large block and calling processSync at the end. However I would like to decompose it a bit and would rather not move back to that. Thanks for any help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
There's a distinction between parser plugins and transformer plugins. The remark plugins you are having issues with Anything that adds a new type of syntax to markdown, is most likely a parser plugin. |
Beta Was this translation helpful? Give feedback.
There's a distinction between parser plugins and transformer plugins.
Transformer plugins work on an AST, and run in the order they are called with
.use()
.Parser plugins work on the raw source text, always run at the beginning of the pipeline (even if they are listed later), and need to be in the same flow as
remark-parse
.The remark plugins you are having issues with
remark-footnotes
,remark-math
, andremark-gfm
are parser plugins.The need to be moved into the same flow/pipeline as
remark-parse
https://github.com/kvietcong/le-atlas/blob/7ce8090c5d21d002173a46cec4feb852f7489376/utils/parsing.js#L51Anything that adds a new type of syntax to markdown, is most likely a parser plugin.
Almo…