markdown link to header

Markdown IDs are generated using some rules i've been able to google: (text to lowercase, non-word punctuation removed, spaces converted to hyphens, two or more hyphens in a row converted to one, naming collisions have incremented number appended, ...)

I found an easy way to figure out what the anchor link should be. Use your browser's HTML inspector to inspect the header you want to link to. The header tag's ID should be what you use. So for example my heading looks like this in the HTML inspector:

<h2 id="markdown-header-changing-plsql-parameters-and-shared-developers-lifecycle">
  Changing PL/SQL parameters and shared developer's lifecycle
</h2>

And I can link to it in markup like so:

[See instructions below](#markdown-header-changing-plsql-parameters-and-shared-developers-lifecycle)

And now "See instructions below" is linked to my header anchor.


In the Documentation you link to we learn that...

The IDs are generated from the content of the header according to the following rules:

  1. All text is converted to lowercase.
  2. All non-word text (e.g., punctuation, HTML) is removed.
  3. All spaces are converted to hyphens.
  4. Two or more hyphens in a row are converted to one.
  5. If a header with the same ID has already been generated, a unique incrementing number is appended, starting at 1.

Note rule 4: "Two or more hyphens in a row are converted to one." However, the example you tried has two hyphens in a row (after the 1). Remove one of them and you should have it.

[link](#1-this-is-my-header)

From time to time I have encountered a unique header which is converted into an ID in some non-obvious way. A quick way to work out the ID is to use your browser's view source and/or inspect tools to view the HTML source code. For example, you might find the following HTML for your example:

<h3 id="1-this-is-my-header">1. This is my Header</h3>

Then just use the contents of the id attribute with a hash to link to that header: #1-this-is-my-header.