Search code examples
markdowngithub-flavored-markdown

Creating anchor link with punctuation and ampersand


I'm trying to create an anchor link in markdown, and the heading I want to link to has both a punctuation mark and an ampersand. I cannot get the anchor link to work.

The heading I want to link to is as follows:

## Selected Essays, Features & Reviews

And I have tried both of the following without success:

[Essays, Features & Reviews](#selected-essays-features-&-reviews)

[Essays, Features & Reviews](#selected-essays-features-reviews)

I understand that the punctuation should be removed so I've ignored the comma, but it still isn't working so I assume I'm doing something wrong with the ampersand.

Thanks in advance!


Solution

  • On Github all entities (including ampersand) in anchors will be removed from between the dashes so your link will look like:

    [Essays, Features & Reviews](#selected-essays-features--reviews)
    

    You can inspect Github generated anchors in your browser by pointing mouse at small chain link icon that appears next to headings when you hover over them.