mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2025-01-31 03:43:46 +01:00
Fixed Jinja error for raw HTML header tags
This commit is contained in:
parent
9e3403ee4f
commit
f40585f528
@ -110,7 +110,7 @@
|
|||||||
<a href="{{ page.edit_url }}" title="{{ lang.t('edit.link.title') }}" class="md-icon md-content__edit">edit</a>
|
<a href="{{ page.edit_url }}" title="{{ lang.t('edit.link.title') }}" class="md-icon md-content__edit">edit</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% if not "\x3ch1 id=" in page.content %}
|
{% if not "\x3ch1" in page.content %}
|
||||||
<h1>{{ page.title | default(config.site_name, true)}}</h1>
|
<h1>{{ page.title | default(config.site_name, true)}}</h1>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ page.content }}
|
{{ page.content }}
|
||||||
|
@ -25,10 +25,10 @@
|
|||||||
<li class="md-nav__item">
|
<li class="md-nav__item">
|
||||||
{% set toc_ = page.toc %}
|
{% 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 "\x3ch1 id=" in page.content %}
|
{% if toc_ | first is defined %}
|
||||||
{% set toc_ = (toc_ | first).children %}
|
{% set toc_ = (toc_ | first).children %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if toc_ and (toc_ | first) %}
|
{% 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 }}
|
{{ nav_item.title }}
|
||||||
</label>
|
</label>
|
||||||
@ -36,7 +36,7 @@
|
|||||||
<a href="{{ nav_item.url }}" title="{{ nav_item.title }}" class="md-nav__link md-nav__link--active">
|
<a href="{{ nav_item.url }}" title="{{ nav_item.title }}" class="md-nav__link md-nav__link--active">
|
||||||
{{ nav_item.title }}
|
{{ nav_item.title }}
|
||||||
</a>
|
</a>
|
||||||
{% if page.toc %}
|
{% if toc_ | first is defined %}
|
||||||
{% include "partials/toc.html" %}
|
{% include "partials/toc.html" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</li>
|
</li>
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
{% import "partials/language.html" as lang %}
|
{% import "partials/language.html" as lang %}
|
||||||
<nav class="md-nav md-nav--secondary">
|
<nav class="md-nav md-nav--secondary">
|
||||||
{% set toc_ = page.toc %}
|
{% set toc_ = page.toc %}
|
||||||
{% if "\x3ch1 id=" in page.content %}
|
{% if toc_ | first is defined and "\x3ch1 id=" in page.content %}
|
||||||
{% set toc_ = (toc_ | first).children %}
|
{% set toc_ = (toc_ | first).children %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if toc_ and (toc_ | first) %}
|
{% 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>
|
<ul class="md-nav__list" data-md-scrollfix>
|
||||||
{% for toc_item in toc_ %}
|
{% for toc_item in toc_ %}
|
||||||
|
@ -218,11 +218,11 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
This is a nasty hack that checks whether the content contains
|
Hack: check whether the content contains a h1 headline. If it
|
||||||
a h1 headline. If it doesn't, the page title (or respectively
|
doesn't, the page title (or respectively site name) is used
|
||||||
site name) is used as the main headline.
|
as the main headline.
|
||||||
-->
|
-->
|
||||||
{% if not "\x3ch1 id=" in page.content %}
|
{% if not "\x3ch1" in page.content %}
|
||||||
<h1>{{ page.title | default(config.site_name, true)}}</h1>
|
<h1>{{ page.title | default(config.site_name, true)}}</h1>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
@ -62,13 +62,13 @@
|
|||||||
<input class="md-toggle md-nav__toggle" data-md-toggle="toc"
|
<input class="md-toggle md-nav__toggle" data-md-toggle="toc"
|
||||||
type="checkbox" id="toc" />
|
type="checkbox" id="toc" />
|
||||||
|
|
||||||
<!-- Nasty hack - see partials/toc.html for more information -->
|
<!-- Hack: see partials/toc.html for more information -->
|
||||||
{% if "\x3ch1 id=" in page.content %}
|
{% if toc_ | first is defined %}
|
||||||
{% set toc_ = (toc_ | first).children %}
|
{% set toc_ = (toc_ | first).children %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<!-- Render table of contents, if not empty -->
|
<!-- Render table of contents, if not empty -->
|
||||||
{% if toc_ and (toc_ | first) %}
|
{% 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 }}
|
{{ nav_item.title }}
|
||||||
</label>
|
</label>
|
||||||
@ -79,7 +79,7 @@
|
|||||||
</a>
|
</a>
|
||||||
|
|
||||||
<!-- Show table of contents -->
|
<!-- Show table of contents -->
|
||||||
{% if page.toc %}
|
{% if toc_ | first is defined %}
|
||||||
{% include "partials/toc.html" %}
|
{% include "partials/toc.html" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</li>
|
</li>
|
||||||
|
@ -27,17 +27,17 @@
|
|||||||
{% set toc_ = page.toc %}
|
{% set toc_ = page.toc %}
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
This is a nasty hack that checks whether the content contains a h1
|
Hack: check whether the content contains a h1 headline. If it does, the
|
||||||
headline. If it does, the top-level anchor must be skipped, since it would
|
top-level anchor must be skipped, since it would be redundant to the link
|
||||||
be redundant to the link to the current page that is located just above the
|
to the current page that is located just above the anchor. Therefore we
|
||||||
anchor. Therefore we directly continue with the children of the anchor.
|
directly continue with the children of the anchor.
|
||||||
-->
|
-->
|
||||||
{% if "\x3ch1 id=" in page.content %}
|
{% if toc_ | first is defined and "\x3ch1 id=" in page.content %}
|
||||||
{% set toc_ = (toc_ | first).children %}
|
{% set toc_ = (toc_ | first).children %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<!-- Render item list -->
|
<!-- Render item list -->
|
||||||
{% if toc_ and (toc_ | first) %}
|
{% 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>
|
<ul class="md-nav__list" data-md-scrollfix>
|
||||||
{% for toc_item in toc_ %}
|
{% for toc_item in toc_ %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user