Skip to content

Commit 3e9bc2f

Browse files
committed
docs: Explain how to find out the anchor of a heading
Issue-75: #75
1 parent a77611b commit 3e9bc2f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ This works the same as [a normal link to that heading](../doc1.md#hello-world).
4747

4848
Linking to a heading without needing to know the destination page can be useful if specifying that path is cumbersome, e.g. when the pages have deeply nested paths, are far apart, or are moved around frequently.
4949

50+
TIP: **Finding the anchor of a heading.** To find the anchor for a specific heading, the easiest way is to serve your docs, go to that heading, click its permalink if there's one, and copy the anchor from the browser URL bar. If the heading doesn't have a permalink, the anchor can be retrieved from the HTML directly (by inspecting the source of the page): it's the `id` attribute of the heading. Generally though, anchors are generated from heading titles by "slugifying" them, i.e. transforming them to lowercase, removing special characters, and replacing spaces with dashes. For example a heading like ``## Hello *World* (and 2 other `things`)`` will be slugified to `hello-world-and-2-other-things`.
51+
5052
### Non-unique headings
5153

5254
When linking to a heading that appears several times throughout the site, this plugin will log a warning message stating that multiple URLs were found and that headings should be made unique, and will resolve the link using the first found URL.

0 commit comments

Comments
 (0)