showdownjs / showdown

A bidirectional Markdown to HTML to Markdown converter written in Javascript
http://www.showdownjs.com/
MIT License
14.26k stars 1.56k forks source link

Can I set Showdown to recognize internal anchors links? #845

Closed PawcioCNCProfi closed 2 years ago

PawcioCNCProfi commented 3 years ago

Hi, My markdown has some local links, but showdown shows them as plain text like: [Declare options](#Declare current operation options) I can't find a mention about this in the documentation, only basic links are discussed :|

SyntaxRules commented 2 years ago

Fragments should be permissible:

CommonMark allows them: https://spec.commonmark.org/0.30/#example-500 Github Markdown allows them: https://github.github.com/gfm/#example-509 DF is ambiguous: https://daringfireball.net/projects/markdown/syntax#link

SyntaxRules commented 2 years ago

However, a space in the fragment name is not permissible. To get your example above to work the markdown needs to change from this:

[Declare options](#Declare current operation options)

to this:

[Declare options](#Declare%20current%20operation%20options)
# or
[Declare options](<#Declare current operation options>)