mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-12-01 02:27:17 +01:00
Added skip link component
This commit is contained in:
parent
dbb5b2e8c3
commit
66376bbe8c
@ -49,6 +49,7 @@ export type Component =
|
|||||||
| "search-query" /* Search input */
|
| "search-query" /* Search input */
|
||||||
| "search-reset" /* Search reset */
|
| "search-reset" /* Search reset */
|
||||||
| "search-result" /* Search results */
|
| "search-result" /* Search results */
|
||||||
|
| "skip" /* Skip link */
|
||||||
| "tabs" /* Tabs */
|
| "tabs" /* Tabs */
|
||||||
| "toc" /* Table of contents */
|
| "toc" /* Table of contents */
|
||||||
|
|
||||||
@ -115,6 +116,7 @@ export function setupComponents(
|
|||||||
/* Top-level components: update */
|
/* Top-level components: update */
|
||||||
case "header-title":
|
case "header-title":
|
||||||
case "container":
|
case "container":
|
||||||
|
case "skip":
|
||||||
if (name in prev && typeof prev[name] !== "undefined") {
|
if (name in prev && typeof prev[name] !== "undefined") {
|
||||||
prev[name]!.replaceWith(next[name]!)
|
prev[name]!.replaceWith(next[name]!)
|
||||||
prev[name] = next[name]
|
prev[name] = next[name]
|
||||||
|
@ -205,7 +205,8 @@
|
|||||||
|
|
||||||
<!-- Link to skip to content -->
|
<!-- Link to skip to content -->
|
||||||
{% if page.toc | first is defined %}
|
{% if page.toc | first is defined %}
|
||||||
<a href="{{ (page.toc | first).url }}" class="md-skip">
|
{% set skip = page.toc | first %}
|
||||||
|
<a href="{{ skip.url | url }}" class="md-skip" data-md-component="skip">
|
||||||
{{ lang.t('skip.link.title') }}
|
{{ lang.t('skip.link.title') }}
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
Loading…
Reference in New Issue
Block a user