diff options
| author | asrar <aszenz@gmail.com> | 2020-06-23 08:00:45 +0530 |
|---|---|---|
| committer | Caleb Cartwright <calebcartwright@users.noreply.github.com> | 2021-08-17 21:55:26 -0500 |
| commit | c5f1d9698e83fbbf59c97aa229804274daf4cc8c (patch) | |
| tree | a43b6ccc40447b1c161a09a848f6058457fdcb22 | |
| parent | 1045c62ac141d98fa7c86deb36887a2a9f9b45f2 (diff) | |
| download | rust-c5f1d9698e83fbbf59c97aa229804274daf4cc8c.tar.gz rust-c5f1d9698e83fbbf59c97aa229804274daf4cc8c.zip | |
Adds direct linking using header ids (#4272)
Separates out search and direct linking, uses header ids for direct linking and `?search=term` for filtering configurations. Once the app mounts the page is scrolled to the current header set in the url hash.
| -rw-r--r-- | docs/index.html | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/docs/index.html b/docs/index.html index cea224f40d7..c89c73d4cf7 100644 --- a/docs/index.html +++ b/docs/index.html @@ -79,13 +79,16 @@ <script> const RusfmtTagsUrl = 'https://api.github.com/repos/rust-lang/rustfmt/tags'; const UrlHash = window.location.hash.replace(/^#/, ''); + const queryParams = new URLSearchParams(window.location.search); + const searchParam = queryParams.get('search'); + const searchTerm = null !== searchParam ? searchParam : ''; new Vue({ el: '#app', data: { aboutHtml: '', configurationAboutHtml: '', configurationDescriptions: [], - searchCondition: UrlHash, + searchCondition: searchTerm, shouldStable: false, version: 'master', oldVersion: undefined, @@ -126,7 +129,9 @@ return marked.parser(ast, { highlight(code, lang) { return hljs.highlight(lang ? lang : 'rust', code).value; - } + }, + headerIds: true, + headerPrefix: '' }); } }, |
