Remark plugin for adding a custom ID attribute to Markdown headers
by sindresorhusJavaScript
Hi! Your plugin is very useful. There is a problem not related with the plugin but with this aproach in Astro mdx files: Some heading title {#anchor-identifier} because the text inside { } in markdown content is interpreted as js code and breaks everything. In one of my Astro projects I'm using this aproach: Some heading title and changing a bit the regex in your plugin (I'm using it as a local module in my project) everything work as expected. I think could be easy to modify the regex to match both patterns. I could make a PR if you are interested. Regards!
Fixes #2 Little change in the regex pattern to match both the regular syntax and the alternative syntax . Changed test.js to include examples with the alternative syntax. Changed readme.md to include a brief explanation and examples of use. As a side effect, the regex pattern match some combinations of delimiters: But I think it is not a big deal. I don't see an easy way to change the regex without changing also the code.
Repository: sindresorhus/remark-custom-header-id. Description: Remark plugin for adding a custom ID attribute to Markdown headers Stars: 47, Forks: 6. Primary language: JavaScript. License: MIT. Topics: markdown, nodejs, npm, remark, remark-plugin. Latest release: v1.0.0 (2y ago). Open PRs: 0, open issues: 0. Last activity: 2y ago. Top contributors: sindresorhus, ffperera.