1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-09-24 19:38:27 +02:00

Scope all internal HTML id tags to avoid name clashes

* Fix ids not being unique enough in templates

* Revert disqus id change
This commit is contained in:
Isaac Muse 2018-06-10 06:45:16 -06:00 committed by Martin Donath
parent 2fbeb28d9d
commit a42fdb33ed
25 changed files with 42 additions and 42 deletions

View File

@ -1,5 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" width="352" height="448"
viewBox="0 0 352 448" id="bitbucket">
viewBox="0 0 352 448" id="__bitbucket">
<path fill="currentColor" d="M203.75 214.75q2 15.75-12.625 25.25t-27.875
1.5q-9.75-4.25-13.375-14.5t-0.125-20.5 13-14.5q9-4.5 18.125-3t16 8.875
6.875 16.875zM231.5 209.5q-3.5-26.75-28.25-41t-49.25-3.25q-15.75

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -1,5 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" width="416" height="448"
viewBox="0 0 416 448" id="github">
viewBox="0 0 416 448" id="__github">
<path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19-18.125
8.5-18.125-8.5-10.75-19-3.125-20.5 3.125-20.5 10.75-19 18.125-8.5
18.125 8.5 10.75 19 3.125 20.5zM320 304q0 10-3.125 20.5t-10.75

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -1,5 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" width="500" height="500"
viewBox="0 0 500 500" id="gitlab">
viewBox="0 0 500 500" id="__gitlab">
<g transform="translate(156.197863, 1.160267)">
<path fill="currentColor"
d="M93.667,473.347L93.667,473.347l90.684-279.097H2.983L93.667,

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -48,7 +48,7 @@
{% endif %}
{% endblock %}
{% block styles %}
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application.8d40d89b.css">
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application.fc30eec9.css">
{% if palette.primary or palette.accent %}
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-palette.6079476c.css">
{% endif %}
@ -83,17 +83,17 @@
<defs>
{% set platform = config.extra.repo_icon or config.repo_url %}
{% if "github" in platform %}
{% include "assets/images/icons/github.a4034fb1.svg" %}
{% include "assets/images/icons/github.f0b8504a.svg" %}
{% elif "gitlab" in platform %}
{% include "assets/images/icons/gitlab.348cdb3a.svg" %}
{% include "assets/images/icons/gitlab.6dd19c00.svg" %}
{% elif "bitbucket" in platform %}
{% include "assets/images/icons/bitbucket.4ebea66e.svg" %}
{% include "assets/images/icons/bitbucket.1b09e088.svg" %}
{% endif %}
</defs>
</svg>
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="drawer" autocomplete="off">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="search" autocomplete="off">
<label class="md-overlay" data-md-component="overlay" for="drawer"></label>
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
<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') }}
@ -170,7 +170,7 @@
{% endblock %}
</div>
{% block scripts %}
<script src="{{ base_url }}/assets/javascripts/application.0cf9b500.js"></script>
<script src="{{ base_url }}/assets/javascripts/application.6cb86621.js"></script>
{% if lang.t("search.language") != "en" %}
{% set languages = lang.t("search.language").split(",") %}
{% if languages | length and languages[0] != "" %}

View File

@ -13,7 +13,7 @@
</a>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--menu md-header-nav__button" for="drawer"></label>
<label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
</div>
<div class="md-flex__cell md-flex__cell--stretch">
<div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
@ -34,7 +34,7 @@
<div class="md-flex__cell md-flex__cell--shrink">
{% block search_box %}
{% if "search" in config["plugins"] %}
<label class="md-icon md-icon--search md-header-nav__button" for="search"></label>
<label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
{% include "partials/search.html" %}
{% endif %}
{% endblock %}

View File

@ -29,12 +29,12 @@
{% elif nav_item == page %}
<li class="{{ class }}">
{% set toc_ = page.toc %}
<input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="toc">
<input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="__toc">
{% if toc_ | first is defined and "\x3ch1 id=" in page.content %}
{% set toc_ = (toc_ | first).children %}
{% endif %}
{% if toc_ | first is defined %}
<label class="md-nav__link md-nav__link--active" for="toc">
<label class="md-nav__link md-nav__link--active" for="__toc">
{{ nav_item.title }}
</label>
{% endif %}

View File

@ -1,5 +1,5 @@
<nav class="md-nav md-nav--primary" data-md-level="0">
<label class="md-nav__title md-nav__title--site" for="drawer">
<label class="md-nav__title md-nav__title--site" for="__drawer">
<span class="md-nav__button md-logo">
{% if config.theme.logo.icon %}
<i class="md-icon">{{ config.theme.logo.icon }}</i>

View File

@ -1,10 +1,10 @@
{% import "partials/language.html" as lang with context %}
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="search"></label>
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" name="search">
<input type="text" class="md-search__input" name="query" placeholder="{{ lang.t('search.placeholder') }}" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="query" data-md-state="active">
<label class="md-icon md-search__icon" for="search"></label>
<label class="md-icon md-search__icon" for="__search"></label>
<button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">
&#xE5CD;
</button>

View File

@ -14,7 +14,7 @@
{% if repo_type %}
<div class="md-source__icon">
<svg viewBox="0 0 24 24" width="24" height="24">
<use xlink:href="#{{ repo_type }}" width="24" height="24"></use>
<use xlink:href="#__{{ repo_type }}" width="24" height="24"></use>
</svg>
</div>
{% endif %}

View File

@ -5,7 +5,7 @@
{% set toc_ = (toc_ | first).children %}
{% endif %}
{% if toc_ | first is defined %}
<label class="md-nav__title" for="toc">{{ lang.t("toc.title") }}</label>
<label class="md-nav__title" for="__toc">{{ lang.t("toc.title") }}</label>
<ul class="md-nav__list" data-md-scrollfix>
{% for toc_item in toc_ %}
{% include "partials/toc-item.html" %}

View File

@ -1,5 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" width="352" height="448"
viewBox="0 0 352 448" id="bitbucket">
viewBox="0 0 352 448" id="__bitbucket">
<path fill="currentColor" d="M203.75 214.75q2 15.75-12.625 25.25t-27.875
1.5q-9.75-4.25-13.375-14.5t-0.125-20.5 13-14.5q9-4.5 18.125-3t16 8.875
6.875 16.875zM231.5 209.5q-3.5-26.75-28.25-41t-49.25-3.25q-15.75

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -1,5 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" width="416" height="448"
viewBox="0 0 416 448" id="github">
viewBox="0 0 416 448" id="__github">
<path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19-18.125
8.5-18.125-8.5-10.75-19-3.125-20.5 3.125-20.5 10.75-19 18.125-8.5
18.125 8.5 10.75 19 3.125 20.5zM320 304q0 10-3.125 20.5t-10.75

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -1,5 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" width="500" height="500"
viewBox="0 0 500 500" id="gitlab">
viewBox="0 0 500 500" id="__gitlab">
<g transform="translate(156.197863, 1.160267)">
<path fill="currentColor"
d="M93.667,473.347L93.667,473.347l90.684-279.097H2.983L93.667,

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -121,7 +121,7 @@
// Hide link to table of contents by default - this will only match the
// table of contents inside the drawer below and including tablet portrait
html &[for="toc"] {
html &[for="__toc"] {
display: none;
// Hide table of contents by default
@ -426,7 +426,7 @@
// Show link to table of contents - higher specificity is necessary to
// display the table of contents inside the drawer
html &__link[for="toc"] {
html &__link[for="__toc"] {
display: block;
padding-right: 4.8rem;

View File

@ -317,7 +317,7 @@ $md-toggle__search--checked:
}
// Search icon
&[for="search"] {
&[for="__search"] {
top: 0.6rem;
left: 1rem;
@ -339,7 +339,7 @@ $md-toggle__search--checked:
left: 1.6rem;
// Show back arrow instead of search icon
&[for="search"]::before {
&[for="__search"]::before {
content: "\E5C4"; // arrow_back
// Adjust for RTL languages

View File

@ -185,12 +185,12 @@
drawer on back button invocation in some browsers
-->
<input class="md-toggle" data-md-toggle="drawer"
type="checkbox" id="drawer" autocomplete="off" />
type="checkbox" id="__drawer" autocomplete="off" />
<input class="md-toggle" data-md-toggle="search"
type="checkbox" id="search" autocomplete="off" />
type="checkbox" id="__search" autocomplete="off" />
<!-- 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 %}

View File

@ -46,7 +46,7 @@
<!-- Button to toggle drawer -->
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--menu md-header-nav__button"
for="drawer"></label>
for="__drawer"></label>
</div>
<!-- Header title -->
@ -73,7 +73,7 @@
{% block search_box %}
{% if "search" in config["plugins"] %}
<label class="md-icon md-icon--search md-header-nav__button"
for="search"></label>
for="__search"></label>
<!-- Search interface -->
{% include "partials/search.html" %}

View File

@ -68,7 +68,7 @@
<!-- Active checkbox expands items contained within nested section -->
<input class="md-toggle md-nav__toggle" data-md-toggle="toc"
type="checkbox" id="toc" />
type="checkbox" id="__toc" />
<!-- Hack: see partials/toc.html for more information -->
{% if toc_ | first is defined and "\x3ch1 id=" in page.content %}
@ -77,7 +77,7 @@
<!-- Render table of contents, if not empty -->
{% if toc_ | first is defined %}
<label class="md-nav__link md-nav__link--active" for="toc">
<label class="md-nav__link md-nav__link--active" for="__toc">
{{ nav_item.title }}
</label>
{% endif %}

View File

@ -24,7 +24,7 @@
<nav class="md-nav md-nav--primary" data-md-level="0">
<!-- Site title -->
<label class="md-nav__title md-nav__title--site" for="drawer">
<label class="md-nav__title md-nav__title--site" for="__drawer">
<span class="md-nav__button md-logo">
{% if config.theme.logo.icon %}
<i class="md-icon">{{ config.theme.logo.icon }}</i>

View File

@ -24,7 +24,7 @@
<!-- Search interface -->
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="search"></label>
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" name="search">
<input type="text" class="md-search__input" name="query"
@ -32,7 +32,7 @@
autocapitalize="off" autocorrect="off" autocomplete="off"
spellcheck="false" data-md-component="query"
data-md-state="active" />
<label class="md-icon md-search__icon" for="search"></label>
<label class="md-icon md-search__icon" for="__search"></label>
<button type="reset" class="md-icon md-search__icon"
data-md-component="reset" tabindex="-1">
&#xE5CD;<!-- close -->

View File

@ -44,7 +44,7 @@
{% if repo_type %}
<div class="md-source__icon">
<svg viewBox="0 0 24 24" width="24" height="24">
<use xlink:href="#{{ repo_type }}" width="24" height="24"></use>
<use xlink:href="#__{{ repo_type }}" width="24" height="24"></use>
</svg>
</div>
{% endif %}

View File

@ -38,7 +38,7 @@
<!-- Render item list -->
{% if toc_ | first is defined %}
<label class="md-nav__title" for="toc">{{ lang.t("toc.title") }}</label>
<label class="md-nav__title" for="__toc">{{ lang.t("toc.title") }}</label>
<ul class="md-nav__list" data-md-scrollfix>
{% for toc_item in toc_ %}
{% include "partials/toc-item.html" %}