mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-11-28 01:10:58 +01:00
Bring back h1 headline handling from 0.2.4
This commit is contained in:
parent
5e6f5d9089
commit
420b841ecf
@ -200,6 +200,13 @@ kbd {
|
||||
margin: 0;
|
||||
background: transparent;
|
||||
box-shadow: none; }
|
||||
.md-typeset a > code {
|
||||
margin: inherit;
|
||||
padding: inherit;
|
||||
border-radius: none;
|
||||
background: inherit;
|
||||
color: inherit;
|
||||
box-shadow: none; }
|
||||
.md-typeset pre {
|
||||
margin: 1.0em 0;
|
||||
padding: 1.0rem 1.2rem;
|
||||
@ -280,6 +287,7 @@ kbd {
|
||||
.md-typeset ol li ol {
|
||||
margin: 0.5em 0 0.5em 0.625em; }
|
||||
.md-typeset table {
|
||||
width: 90%;
|
||||
margin: 1.5em 0;
|
||||
font-size: 1.28rem;
|
||||
overflow: hidden; }
|
||||
@ -300,6 +308,12 @@ kbd {
|
||||
padding: 1.2rem 1.6rem;
|
||||
border-top: 0.1rem solid rgba(0, 0, 0, 0.07);
|
||||
vertical-align: top; }
|
||||
.md-typeset table th[align="right"],
|
||||
.md-typeset table td[align="right"] {
|
||||
text-align: right; }
|
||||
.md-typeset table th[align="center"],
|
||||
.md-typeset table td[align="center"] {
|
||||
text-align: center; }
|
||||
.md-typeset table tr:first-child td {
|
||||
border-top: 0; }
|
||||
|
||||
|
@ -51,7 +51,6 @@
|
||||
<div class="md-container">
|
||||
<main class="md-main">
|
||||
<div class="md-main__inner md-grid">
|
||||
{% set h1 = "\x3ch1 id=" in page.content %}
|
||||
{% block site_nav %}
|
||||
{% if nav %}
|
||||
<div class="md-sidebar md-sidebar--primary" data-md-sidebar="primary">
|
||||
@ -80,6 +79,9 @@
|
||||
Edit
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if not "\x3ch1 id=" in page.content %}
|
||||
<h1>{{ page.title | default(config.site_name, true)}}</h1>
|
||||
{% endif %}
|
||||
{{ page.content }}
|
||||
{% endblock %}
|
||||
<hr>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<nav class="md-nav md-nav--secondary">
|
||||
{% set toc = page.toc %}
|
||||
{% if h1 %}
|
||||
{% if "\x3ch1 id=" in page.content %}
|
||||
{% set toc = (toc | first).children %}
|
||||
{% endif %}
|
||||
{% if toc and (toc | first) %}
|
||||
|
@ -117,14 +117,6 @@
|
||||
<main class="md-main">
|
||||
<div class="md-main__inner md-grid">
|
||||
|
||||
<!--
|
||||
This is a nasty hack that checks whether the content contains a
|
||||
h1 headline. If it does, the variable h1 is set to true. This is
|
||||
necessary for correctly rendering the table of contents which is
|
||||
embedded into the navigation and the actual headline.
|
||||
-->
|
||||
{% set h1 = "\x3ch1 id=" in page.content %}
|
||||
|
||||
<!-- Block: navigation -->
|
||||
{% block site_nav %}
|
||||
|
||||
@ -167,6 +159,15 @@
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
<!--
|
||||
This is a nasty hack that checks whether the content contains
|
||||
a h1 headline. If it doesn't, the page title (or respectively
|
||||
site name) is used as the main headline.
|
||||
-->
|
||||
{% if not "\x3ch1 id=" in page.content %}
|
||||
<h1>{{ page.title | default(config.site_name, true)}}</h1>
|
||||
{% endif %}
|
||||
|
||||
<!-- Content -->
|
||||
{{ page.content }}
|
||||
{% endblock %}
|
||||
|
@ -25,12 +25,12 @@
|
||||
{% set toc = page.toc %}
|
||||
|
||||
<!--
|
||||
The top-level anchor must be skipped if the article contains a h1 headline,
|
||||
since it would be redundant to the link to the current page that is located
|
||||
just above the anchor. Therefore we directly continue with the children of
|
||||
the anchor.
|
||||
This is a nasty hack that checks whether the content contains a h1
|
||||
headline. If it does, the top-level anchor must be skipped, since it would
|
||||
be redundant to the link to the current page that is located just above the
|
||||
anchor. Therefore we directly continue with the children of the anchor.
|
||||
-->
|
||||
{% if h1 %}
|
||||
{% if "\x3ch1 id=" in page.content %}
|
||||
{% set toc = (toc | first).children %}
|
||||
{% endif %}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user