Bring back h1 headline handling from 0.2.4

This commit is contained in:
squidfunk 2016-12-15 18:29:46 +01:00
parent 5e6f5d9089
commit 420b841ecf
7 changed files with 53 additions and 36 deletions

View File

@ -2801,13 +2801,13 @@ var Application =
* this.field('title', 10)
* this.field('tags', 100)
* this.field('body')
*
*
* this.ref('cid')
*
*
* this.pipeline.add(function () {
* // some custom pipeline function
* })
*
*
* })
*
* @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)))
/***/ }
/******/ ]);
/******/ ]);

View File

@ -24,7 +24,7 @@
;(function(window, document, undefined){
var tests = [];
/**
*
@ -73,7 +73,7 @@
}
};
// Fake some of Object.create so we can force non test results to be non "own" properties.
var Modernizr = function() {};
@ -83,10 +83,10 @@
// Overwrite name so constructor name is nicer :D
Modernizr = new Modernizr();
var classes = [];
/**
* is returns a boolean if the typeof an obj is exactly type.
@ -182,7 +182,7 @@
*/
var docElement = document.documentElement;
/**
* 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';
/**
* 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
@ -470,7 +470,7 @@
ModernizrProto.addTest = addTest;
});
/**
@ -746,7 +746,7 @@ Detects support for SVG in `<embed>` or `<object>` elements.
*/
var testStyles = ModernizrProto.testStyles = injectElementWithStyles;
/*!
{
"name": "@font-face",
@ -814,11 +814,11 @@ Detects support for SVG in `<embed>` or `<object>` elements.
*/
var omPrefixes = 'Moz O ms Webkit';
var cssomPrefixes = (ModernizrProto._config.usePrefixes ? omPrefixes.split(' ') : []);
ModernizrProto._cssomPrefixes = cssomPrefixes;
/**
@ -852,7 +852,7 @@ Detects support for SVG in `<embed>` or `<object>` elements.
delete modElem.elem;
});
var mStyle = {
style: modElem.elem.style
@ -864,7 +864,7 @@ Detects support for SVG in `<embed>` or `<object>` elements.
delete mStyle.style;
});
/**
* 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(' ') : []);
ModernizrProto._domPrefixes = domPrefixes;
/**
* 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')
ModernizrProto.testAllProps = testPropsAll;
/**
* 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);
}
ModernizrProto.testAllProps = testAllProps;
/*!
{
"name": "CSS Supports",
@ -1283,4 +1283,4 @@ Detects support for SVG in `<embed>` or `<object>` elements.
;
})(window, document);
})(window, document);

View File

@ -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; }

View File

@ -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>

View File

@ -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) %}

View File

@ -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 %}

View File

@ -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 %}