mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Fixed table of contents breaking when class is set on h1
This commit is contained in:
parent
f9f8c3afdb
commit
8d752312aa
2
material/assets/stylesheets/main.962e687c.min.css
vendored
Normal file
2
material/assets/stylesheets/main.962e687c.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
material/assets/stylesheets/main.962e687c.min.css.map
Normal file
1
material/assets/stylesheets/main.962e687c.min.css.map
Normal file
File diff suppressed because one or more lines are too long
@ -39,10 +39,11 @@
|
|||||||
<li class="{{ class }}">
|
<li class="{{ class }}">
|
||||||
{% set toc = page.toc %}
|
{% set toc = page.toc %}
|
||||||
<input class="md-nav__toggle md-toggle" data-md-toggle="toc" type="checkbox" id="__toc">
|
<input class="md-nav__toggle md-toggle" data-md-toggle="toc" type="checkbox" id="__toc">
|
||||||
{% if toc | first is defined and "\x3ch1 id=" in page.content %}
|
{% set first = toc | first %}
|
||||||
{% set toc = (toc | first).children %}
|
{% if first is defined and first.level == 1 %}
|
||||||
|
{% set toc = first.children %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if toc | first is defined %}
|
{% if toc is iterable %}
|
||||||
<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 }}
|
{{ nav_item.title }}
|
||||||
<span class="md-nav__icon md-icon"></span>
|
<span class="md-nav__icon md-icon"></span>
|
||||||
@ -51,7 +52,7 @@
|
|||||||
<a href="{{ nav_item.url | url }}" class="md-nav__link md-nav__link--active">
|
<a href="{{ nav_item.url | url }}" class="md-nav__link md-nav__link--active">
|
||||||
{{ nav_item.title }}
|
{{ nav_item.title }}
|
||||||
</a>
|
</a>
|
||||||
{% if toc | first is defined %}
|
{% if toc is iterable %}
|
||||||
{% include "partials/toc.html" %}
|
{% include "partials/toc.html" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</li>
|
</li>
|
||||||
|
@ -4,10 +4,11 @@
|
|||||||
{% import "partials/language.html" as lang with context %}
|
{% import "partials/language.html" as lang with context %}
|
||||||
<nav class="md-nav md-nav--secondary" aria-label="{{ lang.t('toc.title') }}">
|
<nav class="md-nav md-nav--secondary" aria-label="{{ lang.t('toc.title') }}">
|
||||||
{% set toc = page.toc %}
|
{% set toc = page.toc %}
|
||||||
{% if toc | first is defined and "\x3ch1 id=" in page.content %}
|
{% set first = toc | first %}
|
||||||
{% set toc = (toc | first).children %}
|
{% if first is defined and first.level == 1 %}
|
||||||
|
{% set toc = first.children %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if toc | first is defined %}
|
{% if toc is iterable %}
|
||||||
<label class="md-nav__title" for="__toc">
|
<label class="md-nav__title" for="__toc">
|
||||||
<span class="md-nav__icon md-icon"></span>
|
<span class="md-nav__icon md-icon"></span>
|
||||||
{{ lang.t("toc.title") }}
|
{{ lang.t("toc.title") }}
|
||||||
|
@ -101,12 +101,13 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- Hack: see partials/toc.html for more information -->
|
<!-- Hack: see partials/toc.html for more information -->
|
||||||
{% if toc | first is defined and "\x3ch1 id=" in page.content %}
|
{% set first = toc | first %}
|
||||||
{% set toc = (toc | first).children %}
|
{% if first is defined and first.level == 1 %}
|
||||||
|
{% set toc = first.children %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<!-- Render table of contents, if not empty -->
|
<!-- Render table of contents, if not empty -->
|
||||||
{% if toc | first is defined %}
|
{% if toc is iterable %}
|
||||||
<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 }}
|
{{ nav_item.title }}
|
||||||
<span class="md-nav__icon md-icon"></span>
|
<span class="md-nav__icon md-icon"></span>
|
||||||
@ -120,7 +121,7 @@
|
|||||||
</a>
|
</a>
|
||||||
|
|
||||||
<!-- Show table of contents -->
|
<!-- Show table of contents -->
|
||||||
{% if toc | first is defined %}
|
{% if toc is iterable %}
|
||||||
{% include "partials/toc.html" %}
|
{% include "partials/toc.html" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</li>
|
</li>
|
||||||
|
@ -32,12 +32,13 @@
|
|||||||
to the current page that is located just above the anchor. Therefore we
|
to the current page that is located just above the anchor. Therefore we
|
||||||
directly continue with the children of the anchor.
|
directly continue with the children of the anchor.
|
||||||
-->
|
-->
|
||||||
{% if toc | first is defined and "\x3ch1 id=" in page.content %}
|
{% set first = toc | first %}
|
||||||
{% set toc = (toc | first).children %}
|
{% if first is defined and first.level == 1 %}
|
||||||
|
{% set toc = first.children %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<!-- Render item list -->
|
<!-- Render item list -->
|
||||||
{% if toc | first is defined %}
|
{% if toc is iterable %}
|
||||||
<label class="md-nav__title" for="__toc">
|
<label class="md-nav__title" for="__toc">
|
||||||
<span class="md-nav__icon md-icon"></span>
|
<span class="md-nav__icon md-icon"></span>
|
||||||
{{ lang.t("toc.title") }}
|
{{ lang.t("toc.title") }}
|
||||||
|
Loading…
Reference in New Issue
Block a user