miaolz123 / vue-markdown

A Powerful and Highspeed Markdown Parser for Vue
https://miaolz123.github.io/vue-markdown/
MIT License
1.89k stars 257 forks source link

Heading IDs #97

Open Radiergummi opened 5 years ago

Radiergummi commented 5 years ago

Is there any way to enable heading IDs you can link to? GitHub does this, for instance, by creating a slug from the heading content and putting it into the id attribute of the heading tag. So, the following heading:

### This is a headline

would be converted to

<h3 id="this-is-a-headline">This is a headline</h3>

This is immensely useful, especially for longer text or documentation.

Radiergummi commented 5 years ago

After looking at markdown-it, there appears to be a plugin available on npm that does just this: https://www.npmjs.com/package/markdown-it-anchor

I guess I could create a PR tomorrow, if you'd be interested?

dominik-korsa commented 4 years ago

https://www.markdownguide.org/extended-syntax/#heading-ids

Radiergummi commented 4 years ago

@dominik-korsa what exactly do you want to tell me..? Yes, the link you pasted without any context shows the syntax I described above. This library currently lacks the capability to do this, hence I opened an issue.

I don't get your comment.