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
@ -2801,13 +2801,13 @@ var Application =
|
|||||||
* this.field('title', 10)
|
* this.field('title', 10)
|
||||||
* this.field('tags', 100)
|
* this.field('tags', 100)
|
||||||
* this.field('body')
|
* this.field('body')
|
||||||
*
|
*
|
||||||
* this.ref('cid')
|
* this.ref('cid')
|
||||||
*
|
*
|
||||||
* this.pipeline.add(function () {
|
* this.pipeline.add(function () {
|
||||||
* // some custom pipeline function
|
* // some custom pipeline function
|
||||||
* })
|
* })
|
||||||
*
|
*
|
||||||
* })
|
* })
|
||||||
*
|
*
|
||||||
* @param {Function} config A function that will be called with the new instance
|
* @param {Function} config A function that will be called with the new instance
|
||||||
@ -5400,4 +5400,4 @@ var Application =
|
|||||||
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(15)))
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(15)))
|
||||||
|
|
||||||
/***/ }
|
/***/ }
|
||||||
/******/ ]);
|
/******/ ]);
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
;(function(window, document, undefined){
|
;(function(window, document, undefined){
|
||||||
var tests = [];
|
var tests = [];
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -73,7 +73,7 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Fake some of Object.create so we can force non test results to be non "own" properties.
|
// Fake some of Object.create so we can force non test results to be non "own" properties.
|
||||||
var Modernizr = function() {};
|
var Modernizr = function() {};
|
||||||
@ -83,10 +83,10 @@
|
|||||||
// Overwrite name so constructor name is nicer :D
|
// Overwrite name so constructor name is nicer :D
|
||||||
Modernizr = new Modernizr();
|
Modernizr = new Modernizr();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var classes = [];
|
var classes = [];
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* is returns a boolean if the typeof an obj is exactly type.
|
* is returns a boolean if the typeof an obj is exactly type.
|
||||||
@ -182,7 +182,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
var docElement = document.documentElement;
|
var docElement = document.documentElement;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A convenience helper to check if the document we are running in is an SVG document
|
* A convenience helper to check if the document we are running in is an SVG document
|
||||||
@ -192,7 +192,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
var isSVG = docElement.nodeName.toLowerCase() === 'svg';
|
var isSVG = docElement.nodeName.toLowerCase() === 'svg';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setClasses takes an array of class names and adds them to the root element
|
* setClasses takes an array of class names and adds them to the root element
|
||||||
@ -260,7 +260,7 @@
|
|||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// _l tracks listeners for async tests, as well as tests that execute after the initial run
|
// _l tracks listeners for async tests, as well as tests that execute after the initial run
|
||||||
@ -470,7 +470,7 @@
|
|||||||
ModernizrProto.addTest = addTest;
|
ModernizrProto.addTest = addTest;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -746,7 +746,7 @@ Detects support for SVG in `<embed>` or `<object>` elements.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
var testStyles = ModernizrProto.testStyles = injectElementWithStyles;
|
var testStyles = ModernizrProto.testStyles = injectElementWithStyles;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
{
|
{
|
||||||
"name": "@font-face",
|
"name": "@font-face",
|
||||||
@ -814,11 +814,11 @@ Detects support for SVG in `<embed>` or `<object>` elements.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
var omPrefixes = 'Moz O ms Webkit';
|
var omPrefixes = 'Moz O ms Webkit';
|
||||||
|
|
||||||
|
|
||||||
var cssomPrefixes = (ModernizrProto._config.usePrefixes ? omPrefixes.split(' ') : []);
|
var cssomPrefixes = (ModernizrProto._config.usePrefixes ? omPrefixes.split(' ') : []);
|
||||||
ModernizrProto._cssomPrefixes = cssomPrefixes;
|
ModernizrProto._cssomPrefixes = cssomPrefixes;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -852,7 +852,7 @@ Detects support for SVG in `<embed>` or `<object>` elements.
|
|||||||
delete modElem.elem;
|
delete modElem.elem;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var mStyle = {
|
var mStyle = {
|
||||||
style: modElem.elem.style
|
style: modElem.elem.style
|
||||||
@ -864,7 +864,7 @@ Detects support for SVG in `<embed>` or `<object>` elements.
|
|||||||
delete mStyle.style;
|
delete mStyle.style;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* domToCSS takes a camelCase string and converts it to kebab-case
|
* domToCSS takes a camelCase string and converts it to kebab-case
|
||||||
@ -1054,7 +1054,7 @@ Detects support for SVG in `<embed>` or `<object>` elements.
|
|||||||
|
|
||||||
var domPrefixes = (ModernizrProto._config.usePrefixes ? omPrefixes.toLowerCase().split(' ') : []);
|
var domPrefixes = (ModernizrProto._config.usePrefixes ? omPrefixes.toLowerCase().split(' ') : []);
|
||||||
ModernizrProto._domPrefixes = domPrefixes;
|
ModernizrProto._domPrefixes = domPrefixes;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fnBind is a super small [bind](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind) polyfill.
|
* fnBind is a super small [bind](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind) polyfill.
|
||||||
@ -1149,7 +1149,7 @@ Detects support for SVG in `<embed>` or `<object>` elements.
|
|||||||
// Modernizr.testAllProps('boxSizing')
|
// Modernizr.testAllProps('boxSizing')
|
||||||
ModernizrProto.testAllProps = testPropsAll;
|
ModernizrProto.testAllProps = testPropsAll;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testAllProps determines whether a given CSS property is supported in the browser
|
* testAllProps determines whether a given CSS property is supported in the browser
|
||||||
@ -1192,7 +1192,7 @@ Detects support for SVG in `<embed>` or `<object>` elements.
|
|||||||
return testPropsAll(prop, undefined, undefined, value, skipValueTest);
|
return testPropsAll(prop, undefined, undefined, value, skipValueTest);
|
||||||
}
|
}
|
||||||
ModernizrProto.testAllProps = testAllProps;
|
ModernizrProto.testAllProps = testAllProps;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
{
|
{
|
||||||
"name": "CSS Supports",
|
"name": "CSS Supports",
|
||||||
@ -1283,4 +1283,4 @@ Detects support for SVG in `<embed>` or `<object>` elements.
|
|||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
})(window, document);
|
})(window, document);
|
@ -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