The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,856 other followers

Linking to part of the same document in Markdown (via: Stack Overflow)

Posted by jpluimers on 2016/02/22

I love markdown, but it lacks the ability to directly create destination anchors (but MarkDownExtra however does for headers)

Anchors can be used to link within and between documents, the foundation of web navigation, and also very important inside documentation.

Luckily, Markdown allows inline HTML, so you can add an HTML destination anchor: an a element with either a name or id attribute.

XHTML deprecated the name attribute, but you should actually use it. The reason is that in HTML5, most browsers create a global JavaScript variable for each id id anchor.

In addition, you should not use a self closing a element: only XHTML supports that.

So the Markdown then becomes something like this:

## <a name='possiblePlatforms'>Possible platforms</a>
Link to [possible platforms](#possiblePlatforms).

view raw

hosted with ❤ by GitHub

In the heading, you will see the html for the destination anchor, in the link you will see the MarkDown for the internal source anchor..

The above example will render like this:


via: How to link to part of the same document in Markdown? – Stack Overflow.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: