Skip to content

Commit 2f28783

Browse files
committed
fix doc
1 parent ec2bf23 commit 2f28783

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/scripts/heading-anchors.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Heading anchors
22

3-
This script is part of `main.js`/`main.min.js`. To help linking to specific parts of pages, this script automatically creates and appends a visible anchor link to the end of any H2-H6 heading within the `<main>` element, with the following exclusions:
3+
This script is part of `main.js`/`main.min.js`. To help linking to specific parts of pages, this script automatically creates and appends a visible anchor link to the end of any H2-H6 heading that have an `id` attribute within the `<main>` element, with the following exclusions:
44

55
- where the heading is a child of a `<nav>` element
66
- where the heading carries the attribute `data-anchor="no"`, the `hidden` attribute or the `.visuallyhidden` class
77
- where a heading has an ancestor carrying the attribute `data-anchor="no"`, the `hidden` attribute or the `.visuallyhidden` class
88

9-
If a heading already has an `id` attribute, this is used when creating the `href` for the `<a>`. Otherwise, the script parses the text content of the heading to create both the heading `id` and the anchor `href`.
9+
The `id` attribute is used when creating the `href` for the `<a>`.
1010

1111
To override the default behaviour of the script and prevent the addition of anchor links to headings, modify the HTML markup to apply the `data-anchor="no"` attribute to an individual heading (or to a parent container, if targeting a group of headings).
1212

@@ -18,4 +18,4 @@ The `data-anchor="no"` attribute has been added directly to the markup to overri
1818
- [collapsible containers](../components/collapsible-containers.md)
1919
- [evangelists](../components/evangelists.md)
2020
- [group list](../components/group-list.md)
21-
- [notes](../components/notes.md)
21+
- [notes](../components/notes.md)

0 commit comments

Comments
 (0)