Skip to content

Commit

Permalink
docs: add anchors to headings inside docs content (#16134)
Browse files Browse the repository at this point in the history
* docs: add anchors to headings inside docs content

* chore: update for docs alone

* chore: replace with older tag
  • Loading branch information
harish-sethuraman committed Jul 20, 2022
1 parent 1233bee commit 2aadc93
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/src/_includes/layouts/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
<script type="module" src="{{ '/assets/js/search.js' | url }}"></script>
<link rel="stylesheet" type="text/css" href="{{ '/assets/css/styles.css' | url }}">
<link rel="stylesheet" href="{{ '/assets/css/print.css' | url }}" media="print">
<script src="https://unpkg.com/anchor-js@4.3.1/anchor.min.js"></script>
</head>

<body class="{{ hook }} docs">
Expand Down
4 changes: 4 additions & 0 deletions docs/src/assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,3 +276,7 @@ if (index) {
allCollapsed: false
});
}

document.addEventListener("DOMContentLoaded", () => {
anchors.add(".docs-content h2:not(.c-toc__label), .docs-content h3, .docs-content h4");
});

0 comments on commit 2aadc93

Please sign in to comment.