mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2026-07-31 09:48:53 -04:00
Fixed table of contents breaking when class is set on h1
This commit is contained in:
@@ -101,12 +101,13 @@
|
||||
/>
|
||||
|
||||
<!-- Hack: see partials/toc.html for more information -->
|
||||
{% if toc | first is defined and "\x3ch1 id=" in page.content %}
|
||||
{% set toc = (toc | first).children %}
|
||||
{% set first = toc | first %}
|
||||
{% if first is defined and first.level == 1 %}
|
||||
{% set toc = first.children %}
|
||||
{% endif %}
|
||||
|
||||
<!-- 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">
|
||||
{{ nav_item.title }}
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
@@ -120,7 +121,7 @@
|
||||
</a>
|
||||
|
||||
<!-- Show table of contents -->
|
||||
{% if toc | first is defined %}
|
||||
{% if toc is iterable %}
|
||||
{% include "partials/toc.html" %}
|
||||
{% endif %}
|
||||
</li>
|
||||
|
||||
@@ -32,12 +32,13 @@
|
||||
to the current page that is located just above the anchor. Therefore we
|
||||
directly continue with the children of the anchor.
|
||||
-->
|
||||
{% if toc | first is defined and "\x3ch1 id=" in page.content %}
|
||||
{% set toc = (toc | first).children %}
|
||||
{% set first = toc | first %}
|
||||
{% if first is defined and first.level == 1 %}
|
||||
{% set toc = first.children %}
|
||||
{% endif %}
|
||||
|
||||
<!-- Render item list -->
|
||||
{% if toc | first is defined %}
|
||||
{% if toc is iterable %}
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
{{ lang.t("toc.title") }}
|
||||
|
||||
Reference in New Issue
Block a user