Skip to content
All Markdown syntax

Link to a section (anchor links) in Markdown

Links and images

Markdown syntax

GitHub Flavored Markdown
[Install](#install)

Link to a heading in the same file by its ID.

Headings get an ID made from their text: lowercase, spaces become hyphens, and most punctuation is dropped. "## Rate limits (API)" becomes #rate-limits-api. Link to it with a # and the ID.

All ways to write it

  • [Install](#install)
    Link to a heading in the same file by its ID.GitHub Flavored Markdown
  • [Limits](./api.md#rate-limits)
    A heading in another file.GitHub Flavored Markdown
  • <a id="custom-anchor"></a>
    A custom anchor anywhere in the text.Needs HTML

Example

You type

Jump to [known issues](#known-issues).

## Known issues

Footnotes may not convert on import.

You get

Jump to known issues.

Known issues

Footnotes may not convert on import.

Questions

What ID does a heading with duplicates get?

On GitHub the second heading with the same text gets -1 appended, the third -2, and so on.

Can I set my own heading ID?

Pandoc, kramdown and some static site tools accept ## Heading {#my-id}. GitHub does not; put an <a id="my-id"></a> before the heading instead.

Link to a section in Confluence

Confluence builds its own anchors for headings, and its Anchor macro sets one anywhere on a page. When you export with Markdown Exporter, links between pages become relative .md links you can follow in Git or Obsidian.

Related syntax

Also in Links and images

See all Markdown syntax