-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
MDXv2 broken with remark-heading-id #1953
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
https://github.com/imcuttle/remark-heading-id hasn't been updated in several years, and doesn't support the latest version of remark/micromark (imcuttle/remark-heading-id#1) which by extension means it doesn't work with the latest version of mdx. |
Hm. I have a local version of remark-heading-id that uses "unist-util-visit": "^4.1.0" instead (which should use micromark afaict?) and it doesn't seem to work still. Am I missing something? |
There's a deeper upgrade needed to make it work with MDX. |
Thanks, that helps! One more question: I'm looking at @mdx-js/mdx's |
It would be registered as a plugin, similar to how MDX itself registers itself and extends mdx/packages/remark-mdx/index.js Lines 10 to 39 in e527ac7
|
Thanks for all the pointers! ended up making a separate package: remark-custom-heading-id. The micromark code is substantially different than the |
I'd say thank you so much @Eyas that repo helped me a lot. |
Hello, hope you can still help me, I want to use the function mdxStringify(this: Processor) {
const compiler = (tree: Node): string => {
const markdown = toMarkdown(tree, {
extensions: [gfmToMarkdown(), mdxToMarkdown()],
bullet: "-",
emphasis: "_",
fences: true,
resourceLink: true,
});
return markdown;
};
Object.assign(this, { Compiler: compiler });
} If I remove the |
@Danii2020 welcome! 👋 Some suggestions on how to proceed:
|
Initial checklist
Affected packages and versions
2.0.0
Link to runnable example
No response
Steps to reproduce
remark-heading-id
## foo {#heading}
Expected behavior
The plugin handles the
{#...}
extended markup syntax, and MDX parses the document normallyActual behavior
Get error:
Could not parse expression with acorn: Unexpected character '#'
It makes sense that MDX thinks that
{...}
syntax is inline JS, but I would have thought plugins can be used to support heading ID Markdown extended syntax.Runtime
Node v16
Package manager
npm v8
OS
Windows
Build and bundle tools
No response
The text was updated successfully, but these errors were encountered: