-
Notifications
You must be signed in to change notification settings - Fork 433
header ids
David D Lowe edited this page Feb 21, 2017
·
2 revisions
The header-ids
extra does not introduce any new Markdown syntax. Instead, it simply takes modifies the headings generated and gives them unique id
attributes. This allows you to link to section within a document using a fragment.
For instance, that this plain Markdown:
# The book of many colours
## Red
## Yellow
## Purple
## Purple
It will produce HTML like this:
<h1 id="the-book-of-many-colours">The book of many colours</h1>
<h2 id="red">Red</h2>
<h2 id="yellow">Yellow</h2>
<h2 id="purple">Purple</h2>
<h2 id="purple-2">Purple</h2>
You can then link to sections like this: http://example.com/document.html#the-book-of-many-colours
The IDs generated are ASCII with no special characters like spaces. A dash and a number are appended if necessary to keep the IDs unique.
- TODO: are there any other Markdown implementations that do this?
(Return to Extras page.)