notaapp / talk

Issues and discussions for the notes app, Nota.
https://nota.md
59 stars 1 forks source link

Support GitHub automatic header anchor links #346

Open ace-dent opened 1 year ago

ace-dent commented 1 year ago

Create document with header #foo - bar

On GitHub (and other services), this will automatically create the anchor: <a id="foo---bar">#foo - bar</a>. There's a range of other 'fun' conditions (e.g. hyphen: foo – bar > foo--bar).

It would be great if these could be supported in Nota while previewing. Use case is creating a TOC at the top of the document and hard coding these links. Also support while editing would be nice; currently the auto-suggestion doesn't create links that work with GitHub in these cases.

Current work around: manually add anchors around each heading <a id="foo-bar">#foo - bar</a>. This ends up creating two anchors in GitHub: foo---bar and user-content-foo-bar (foo-bar is supported by the site's JS to deal with the user-content prefix)... It also clutters up the markdown file and makes it less human readable.

(Enhancement is probably related to #335).

astoilkov commented 1 year ago

Yeah, nice improvement idea. Thanks!

ace-dent commented 1 year ago

Thanks @astoilkov. I created this markdown.md to test possible characters. It helped me get my head around what GitHub is doing when rendering md.

astoilkov commented 1 year ago

Oh, cool. Thanks! I downloaded it. This would be very useful.