mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Added support for skip-to-content link
This commit is contained in:
parent
c3cdb945a6
commit
0e1850280a
@ -115,7 +115,7 @@ If you're using Windows command prompt (`cmd.exe`), substitute `${PWD}` with
|
|||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
In order to enable the theme just add one of the following lines to your
|
In order to enable the theme just add one of the following lines to your
|
||||||
project's `mkdocs.yml`. If you installed Material using pip:
|
project's `mkdocs.yml`. If you installed Material using a package manager:
|
||||||
|
|
||||||
``` yaml
|
``` yaml
|
||||||
theme:
|
theme:
|
||||||
@ -335,9 +335,9 @@ Material supports both, left-to-right (`ltr`) and right-to-left (`rtl`) text
|
|||||||
direction. This enables more languages like Arabic, Hebrew, Syriac and others
|
direction. This enables more languages like Arabic, Hebrew, Syriac and others
|
||||||
to be used with the theme:
|
to be used with the theme:
|
||||||
|
|
||||||
```
|
``` yaml
|
||||||
theme:
|
theme:
|
||||||
direction: rtl
|
direction: 'rtl'
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Site search
|
#### Site search
|
||||||
|
File diff suppressed because one or more lines are too long
2
material/assets/stylesheets/application.f450e885.css
Normal file
2
material/assets/stylesheets/application.f450e885.css
Normal file
File diff suppressed because one or more lines are too long
@ -46,7 +46,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block styles %}
|
{% block styles %}
|
||||||
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application.2a88008a.css">
|
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application.f450e885.css">
|
||||||
{% if palette.primary or palette.accent %}
|
{% if palette.primary or palette.accent %}
|
||||||
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-palette.792431c1.css">
|
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-palette.792431c1.css">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -92,6 +92,11 @@
|
|||||||
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="drawer">
|
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="drawer">
|
||||||
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="search">
|
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="search">
|
||||||
<label class="md-overlay" data-md-component="overlay" for="drawer"></label>
|
<label class="md-overlay" data-md-component="overlay" for="drawer"></label>
|
||||||
|
{% if page.toc | first is defined %}
|
||||||
|
<a href="{{ (page.toc | first).url }}" tabindex="1" class="md-skip">
|
||||||
|
{{ lang.t('skip.link.title') }}
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
{% block header %}
|
{% block header %}
|
||||||
{% include "partials/header.html" %}
|
{% include "partials/header.html" %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@ -162,7 +167,7 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script src="{{ base_url }}/assets/javascripts/application.d5140e78.js"></script>
|
<script src="{{ base_url }}/assets/javascripts/application.fa71e325.js"></script>
|
||||||
{% if lang.t("search.language") != "en" %}
|
{% if lang.t("search.language") != "en" %}
|
||||||
{% set languages = lang.t("search.language").split(",") %}
|
{% set languages = lang.t("search.language").split(",") %}
|
||||||
{% if languages | length and languages[0] != "" %}
|
{% if languages | length and languages[0] != "" %}
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
"search.result.one": "1 matching document",
|
"search.result.one": "1 matching document",
|
||||||
"search.result.other": "# matching documents",
|
"search.result.other": "# matching documents",
|
||||||
"search.tokenizer": "[\s\-]+",
|
"search.tokenizer": "[\s\-]+",
|
||||||
|
"skip.link.title": "Skip to content",
|
||||||
"source.link.title": "Go to repository",
|
"source.link.title": "Go to repository",
|
||||||
"toc.title": "Table of contents"
|
"toc.title": "Table of contents"
|
||||||
}[key] }}{% endmacro %}
|
}[key] }}{% endmacro %}
|
||||||
|
@ -55,13 +55,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hide anchor for top-level heading, as it makes no sense
|
|
||||||
h1[id] .headerlink {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Correct anchor offset for link blurring
|
// Correct anchor offset for link blurring
|
||||||
@each $level, $delta in (
|
@each $level, $delta in (
|
||||||
|
h1: 10rem,
|
||||||
h2: 0.8rem,
|
h2: 0.8rem,
|
||||||
h3: 0.9rem,
|
h3: 0.9rem,
|
||||||
h4: 0.9rem,
|
h4: 0.9rem,
|
||||||
|
@ -201,6 +201,40 @@ hr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Rules: skip link
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Skip link
|
||||||
|
.md-skip {
|
||||||
|
position: fixed;
|
||||||
|
width: 0.1rem;
|
||||||
|
height: 0.1rem;
|
||||||
|
margin: 1rem;
|
||||||
|
padding: 0.6rem 1rem;
|
||||||
|
clip: rect(0.1rem);
|
||||||
|
transform: translateY(0.8rem);
|
||||||
|
border-radius: 0.2rem;
|
||||||
|
background-color: $md-color-black;
|
||||||
|
color: $md-color-white;
|
||||||
|
font-size: ms(-1);
|
||||||
|
opacity: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
// Show skip link on focus
|
||||||
|
&:focus {
|
||||||
|
width: auto;
|
||||||
|
height: auto;
|
||||||
|
clip: auto;
|
||||||
|
transform: translateX(0);
|
||||||
|
transition:
|
||||||
|
transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
|
||||||
|
opacity 0.175s 0.075s;
|
||||||
|
opacity: 1;
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// Rules: print styles
|
// Rules: print styles
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@ -185,6 +185,14 @@
|
|||||||
<!-- Overlay for expanded drawer -->
|
<!-- Overlay for expanded drawer -->
|
||||||
<label class="md-overlay" data-md-component="overlay" for="drawer"></label>
|
<label class="md-overlay" data-md-component="overlay" for="drawer"></label>
|
||||||
|
|
||||||
|
<!-- Render "skip to content" link -->
|
||||||
|
{% if page.toc | first is defined %}
|
||||||
|
<a href="{{ (page.toc | first).url }}" tabindex="1"
|
||||||
|
class="md-skip">
|
||||||
|
{{ lang.t('skip.link.title') }}
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<!-- Application header -->
|
<!-- Application header -->
|
||||||
{% block header %}
|
{% block header %}
|
||||||
{% include "partials/header.html" %}
|
{% include "partials/header.html" %}
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
"search.result.one": "1 matching document",
|
"search.result.one": "1 matching document",
|
||||||
"search.result.other": "# matching documents",
|
"search.result.other": "# matching documents",
|
||||||
"search.tokenizer": "[\s\-]+",
|
"search.tokenizer": "[\s\-]+",
|
||||||
|
"skip.link.title": "Skip to content",
|
||||||
"source.link.title": "Go to repository",
|
"source.link.title": "Go to repository",
|
||||||
"toc.title": "Table of contents"
|
"toc.title": "Table of contents"
|
||||||
}[key] }}{% endmacro %}
|
}[key] }}{% endmacro %}
|
||||||
|
Loading…
Reference in New Issue
Block a user