wooorm / markdown-rs

CommonMark compliant markdown parser in Rust with ASTs and extensions
https://docs.rs/markdown/1.0.0-alpha.21/markdown/
MIT License
906 stars 50 forks source link

Automatically add IDs to headings #76

Open IndigoCurnick opened 1 year ago

IndigoCurnick commented 1 year ago

Hi!

In older versions of the crate, HTML headings would automatically be assigned an id based on the markdown heading

For example,

# Hello World

would become

<h1 id="hello_world">Hello World</h1>

Is there an option for this? If not, would it be possible to support it?

Thanks :)

wooorm commented 1 year ago

Hey!

No, no option.

I’d prefer to land plugins first (see other issues). Then those could solve this nicely!

IndigoCurnick commented 1 year ago

I was just checking out issue #32 which does seem to be what we want here, I think?

wooorm commented 1 year ago

yep, things like that!

Liboq commented 11 months ago

I was just checking out issue #32 which does seem to be what we want here, I think?我刚刚查看了问题 #32,我认为这似乎是我们想要的?

hey,How did you accomplish it,I met the same problem

IndigoCurnick commented 11 months ago

Not quite yet, looks like #32 is still in development and this will need to wait till then unfortunately. I did write something which inserts them after the fact, but it's a little complicated and not really that good

tsurumi-yizhou commented 10 months ago

Either the customized "class" not work?