mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03: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;
|
margin: 0;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
box-shadow: none; }
|
box-shadow: none; }
|
||||||
|
.md-typeset a > code {
|
||||||
|
margin: inherit;
|
||||||
|
padding: inherit;
|
||||||
|
border-radius: none;
|
||||||
|
background: inherit;
|
||||||
|
color: inherit;
|
||||||
|
box-shadow: none; }
|
||||||
.md-typeset pre {
|
.md-typeset pre {
|
||||||
margin: 1.0em 0;
|
margin: 1.0em 0;
|
||||||
padding: 1.0rem 1.2rem;
|
padding: 1.0rem 1.2rem;
|
||||||
@ -280,6 +287,7 @@ kbd {
|
|||||||
.md-typeset ol li ol {
|
.md-typeset ol li ol {
|
||||||
margin: 0.5em 0 0.5em 0.625em; }
|
margin: 0.5em 0 0.5em 0.625em; }
|
||||||
.md-typeset table {
|
.md-typeset table {
|
||||||
|
width: 90%;
|
||||||
margin: 1.5em 0;
|
margin: 1.5em 0;
|
||||||
font-size: 1.28rem;
|
font-size: 1.28rem;
|
||||||
overflow: hidden; }
|
overflow: hidden; }
|
||||||
@ -300,6 +308,12 @@ kbd {
|
|||||||
padding: 1.2rem 1.6rem;
|
padding: 1.2rem 1.6rem;
|
||||||
border-top: 0.1rem solid rgba(0, 0, 0, 0.07);
|
border-top: 0.1rem solid rgba(0, 0, 0, 0.07);
|
||||||
vertical-align: top; }
|
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 {
|
.md-typeset table tr:first-child td {
|
||||||
border-top: 0; }
|
border-top: 0; }
|
||||||
|
|
||||||
|
@ -51,7 +51,6 @@
|
|||||||
<div class="md-container">
|
<div class="md-container">
|
||||||
<main class="md-main">
|
<main class="md-main">
|
||||||
<div class="md-main__inner md-grid">
|
<div class="md-main__inner md-grid">
|
||||||
{% set h1 = "\x3ch1 id=" in page.content %}
|
|
||||||
{% block site_nav %}
|
{% block site_nav %}
|
||||||
{% if nav %}
|
{% if nav %}
|
||||||
<div class="md-sidebar md-sidebar--primary" data-md-sidebar="primary">
|
<div class="md-sidebar md-sidebar--primary" data-md-sidebar="primary">
|
||||||
@ -80,6 +79,9 @@
|
|||||||
Edit
|
Edit
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if not "\x3ch1 id=" in page.content %}
|
||||||
|
<h1>{{ page.title | default(config.site_name, true)}}</h1>
|
||||||
|
{% endif %}
|
||||||
{{ page.content }}
|
{{ page.content }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
<hr>
|
<hr>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<nav class="md-nav md-nav--secondary">
|
<nav class="md-nav md-nav--secondary">
|
||||||
{% set toc = page.toc %}
|
{% set toc = page.toc %}
|
||||||
{% if h1 %}
|
{% if "\x3ch1 id=" in page.content %}
|
||||||
{% set toc = (toc | first).children %}
|
{% set toc = (toc | first).children %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if toc and (toc | first) %}
|
{% if toc and (toc | first) %}
|
||||||
|
@ -117,14 +117,6 @@
|
|||||||
<main class="md-main">
|
<main class="md-main">
|
||||||
<div class="md-main__inner md-grid">
|
<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: navigation -->
|
||||||
{% block site_nav %}
|
{% block site_nav %}
|
||||||
|
|
||||||
@ -167,6 +159,15 @@
|
|||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% 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 -->
|
<!-- Content -->
|
||||||
{{ page.content }}
|
{{ page.content }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -25,12 +25,12 @@
|
|||||||
{% set toc = page.toc %}
|
{% set toc = page.toc %}
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
The top-level anchor must be skipped if the article contains a h1 headline,
|
This is a nasty hack that checks whether the content contains a h1
|
||||||
since it would be redundant to the link to the current page that is located
|
headline. If it does, the top-level anchor must be skipped, since it would
|
||||||
just above the anchor. Therefore we directly continue with the children of
|
be redundant to the link to the current page that is located just above the
|
||||||
the anchor.
|
anchor. Therefore we directly continue with the children of the anchor.
|
||||||
-->
|
-->
|
||||||
{% if h1 %}
|
{% if "\x3ch1 id=" in page.content %}
|
||||||
{% set toc = (toc | first).children %}
|
{% set toc = (toc | first).children %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user