Toggle table of contents via front matter (#1310)

* Add jekyll-toc include
* Reduce whitespace generated by comments
* Add table of contents include to `single` layout
* Replace `toc` include with jekyll-toc enabled YAML Front Matter
* Update README
* Update table of contents documentation
  - Revise `toc` helper include to mention that it will be deprecated in the next major version.
  - Add documentation to `single` layout explaining how to enable table of contents on those pages.
* Update CHANGELOG and history
* Update LICENSE

Close #1222
This commit is contained in:
Michael Rose
2017-10-20 14:54:06 -04:00
committed by GitHub
parent 4b2487722c
commit 866fb17d9e
29 changed files with 332 additions and 286 deletions

View File

@@ -1,100 +0,0 @@
---
title: "Layout: Post with Table Of Contents Included at Bottom"
header:
image: assets/images/unsplash-image-9.jpg
caption: "Photo credit: [**Unsplash**](https://unsplash.com)"
tags:
- table of contents
---
Testing Kramdown auto-generated table of contents included near the end of post content. If positioned correctly with CSS, it should appear in aligned (and to the right) of the main content.
```liquid
{% raw %}{% include toc title="Unique Title" icon="file-text" %}{% endraw %}
```
## HTML Elements
Below is just about everything you'll need to style in the theme. Check the source code to see the many embedded elements within paragraphs.
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
## Body text
Lorem ipsum dolor sit amet, test link adipiscing elit. **This is strong**. Nullam dignissim convallis est. Quisque aliquam.
![Smithsonian Image]({{ site.url }}{{ site.baseurl }}/assets/images/3953273590_704e3899d5_m.jpg)
{: .image-right}
*This is emphasized*. Donec faucibus. Nunc iaculis suscipit dui. 53 = 125. Water is H2O. Nam sit amet sem. Aliquam libero nisi, imperdiet at, tincidunt nec, gravida vehicula, nisl. The New York Times (Thats a citation). Underline.Maecenas ornare tortor. Donec sed tellus eget sapien fringilla nonummy. Mauris a ante. Suspendisse quam sem, consequat at, commodo vitae, feugiat in, nunc. Morbi imperdiet augue quis tellus.
HTML and CSS are our tools. Mauris a ante. Suspendisse quam sem, consequat at, commodo vitae, feugiat in, nunc. Morbi imperdiet augue quis tellus. Praesent mattis, massa quis luctus fermentum, turpis mi volutpat justo, eu volutpat enim diam eget metus.
### Blockquotes
> Lorem ipsum dolor sit amet, test link adipiscing elit. Nullam dignissim convallis est. Quisque aliquam.
## List Types
### Ordered Lists
1. Item one
1. sub item one
2. sub item two
3. sub item three
2. Item two
### Unordered Lists
* Item one
* Item two
* Item three
## Tables
| Header1 | Header2 | Header3 |
|:--------|:-------:|--------:|
| cell1 | cell2 | cell3 |
| cell4 | cell5 | cell6 |
|----
| cell1 | cell2 | cell3 |
| cell4 | cell5 | cell6 |
|=====
| Foot1 | Foot2 | Foot3
{: rules="groups"}
## Code Snippets
```css
#container {
float: left;
margin: 0 -240px 0 0;
width: 100%;
}
```
## Buttons
Make any link standout more when applying the `.btn` class.
```html
<a href="#" class="btn btn-success">Success Button</a>
```
<div markdown="0"><a href="#" class="btn">Primary Button</a></div>
<div markdown="0"><a href="#" class="btn btn--success">Success Button</a></div>
<div markdown="0"><a href="#" class="btn btn--warning">Warning Button</a></div>
<div markdown="0"><a href="#" class="btn btn--danger">Danger Button</a></div>
<div markdown="0"><a href="#" class="btn btn--info">Info Button</a></div>
## Notices
**Watch out!** You can also add notices by appending `{: .notice}` to a paragraph.
{: .notice}
{% include toc title="Unique Title" icon="file-text" %}

View File

@@ -5,27 +5,25 @@ header:
caption: "Photo credit: [**Unsplash**](https://unsplash.com)"
tags:
- table of contents
toc: true
toc_label: "Unique Title"
toc_icon: "heart"
---
{% include toc title="Unique Title" icon="file-text" %}
Enable table of contents on post or page by adding `toc: true` to its YAML Front Matter. The title and icon can also be changed with:
Testing Kramdown auto-generated table of contents with unique title and icon assigned in the include like so:
```liquid
{% raw %}{% include toc title="Unique Title" icon="file-text" %}{% endraw %}
```yaml
---
toc: true
toc_label: "Unique Title"
toc_icon: "heart" # corresponding Font Awesome icon name (without fa prefix)
---
```
## HTML Elements
Below is just about everything you'll need to style in the theme. Check the source code to see the many embedded elements within paragraphs.
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
## Body text
Lorem ipsum dolor sit amet, test link adipiscing elit. **This is strong**. Nullam dignissim convallis est. Quisque aliquam.

View File

@@ -10,12 +10,11 @@ tags:
- formatting
- html
- markup
toc: true
---
A variety of common markup showing how the theme styles them.
# Header one
## Header two
### Header three
@@ -121,7 +120,8 @@ Make any link standout more when applying the `.btn` class.
<a href="#" class="btn--success">Success Button</a>
```
[Primary Button](#){: .btn}
[Default Button](#){: .btn}
[Primary Button](#){: .btn .btn--primary}
[Success Button](#){: .btn .btn--success}
[Warning Button](#){: .btn .btn--warning}
[Danger Button](#){: .btn .btn--danger}
@@ -130,7 +130,8 @@ Make any link standout more when applying the `.btn` class.
[Light Outline Button](#){: .btn .btn--light-outline}
```markdown
[Primary Button Text](#link){: .btn}
[Default Button Text](#link){: .btn}
[Primary Button Text](#link){: .btn .btn--primary}
[Success Button Text](#link){: .btn .btn--success}
[Warning Button Text](#link){: .btn .btn--warning}
[Danger Button Text](#link){: .btn .btn--danger}
@@ -139,23 +140,38 @@ Make any link standout more when applying the `.btn` class.
[Light Outline Button](#link){: .btn .btn--light-outline}
```
[X-Large Button](#){: .btn .btn--x-large}
[Large Button](#){: .btn .btn--large}
[Default Button](#){: .btn}
[Small Button](#){: .btn .btn--small}
[X-Large Button](#){: .btn .btn--primary .btn--x-large}
[Large Button](#){: .btn .btn--primary .btn--large}
[Default Button](#){: .btn .btn--primary }
[Small Button](#){: .btn .btn--primary .btn--small}
```markdown
[X-Large Button](#link){: .btn .btn--x-large}
[Large Button](#link){: .btn .btn--large}
[Default Button](#link){: .btn}
[Small Button](#link){: .btn .btn--small}
[X-Large Button](#link){: .btn .btn--primary .btn--x-large}
[Large Button](#link){: .btn .btn--primary .btn--large}
[Default Button](#link){: .btn .btn--primary }
[Small Button](#link){: .btn .btn--primary .btn--small}
```
## Notices
**Watch out!** You can also add notices by appending `{: .notice}` to a paragraph.
**Watch out!** This paragraph of text has been [emphasized](#) with the `{: .notice}` class.
{: .notice}
**Watch out!** This paragraph of text has been [emphasized](#) with the `{: .notice--primary}` class.
{: .notice--primary}
**Watch out!** This paragraph of text has been [emphasized](#) with the `{: .notice--info}` class.
{: .notice--info}
**Watch out!** This paragraph of text has been [emphasized](#) with the `{: .notice--warning}` class.
{: .notice--warning}
**Watch out!** This paragraph of text has been [emphasized](#) with the `{: .notice--success}` class.
{: .notice--success}
**Watch out!** This paragraph of text has been [emphasized](#) with the `{: .notice--danger}` class.
{: .notice--danger}
## HTML Tags
### Address Tag
@@ -226,8 +242,8 @@ Getting our science styling on with H<sub>2</sub>O, which should push the "2" do
### Superscript Tag
Still sticking with science and Albert Einstein's E = MC<sup>2</sup>, which should lift the 2 up.
Still sticking with science and Isaac Newton's E = MC<sup>2</sup>, which should lift the 2 up.
### Variable Tag
This allows you to denote <var>variables</var>.
This allows you to denote <var>variables</var>.

View File

@@ -1,12 +1,13 @@
---
title: "Markup: Syntax Highlighting"
excerpt: "Post displaying the various ways of highlighting code in Markdown."
last_modified_at: 2017-07-07T15:32:43-04:00
last_modified_at: 2017-10-20T12:23:00-04:00
header:
teaser: "assets/images/markup-syntax-highlighting-teaser.jpg"
tags:
- code
- syntax highlighting
toc: true
---
Syntax highlighting is a feature that displays source code, in different colors and fonts according to the category of terms. This feature facilitates writing in a structured language such as a programming language or a markup language as both structures and syntax errors are visually distinct. Highlighting does not affect the meaning of the text itself; it is intended only for human readers.[^1]
@@ -98,4 +99,4 @@ Indentation matters. Be sure the indent of the code block aligns with the first
An example of a Gist embed below.
<script src="https://gist.github.com/mmistakes/77c68fbb07731a456805a7b473f47841.js"></script>
<script src="https://gist.github.com/mmistakes/77c68fbb07731a456805a7b473f47841.js"></script>

View File

@@ -1,16 +1,16 @@
---
title: "Gemified Theme -- Alpha Release"
last_modified_at: 2016-11-03T11:46:00-04:00
last_modified_at: 2017-10-20T12:29:34-04:00
categories:
- Jekyll
tags:
- update
toc: true
toc_label: "Getting Started"
---
Jekyll [themes distributed as Ruby gems](http://jekyllrb.com/docs/themes/) are finally here to make installing and upgrading much easier. Gone are the days of forking a repo just to "install it". Or dealing with merge conflicts when pulling in upstream commits to "upgrade it".
{% include toc title="Getting Started" %}
If you're interested in testing out Minimal Mistakes as a gemified theme read on. There are a few caveats though:
1. Support for a theme `assets` folder was recently [added to Jekyll core](https://github.com/jekyll/jekyll/pull/5364), but has yet to be released or rolled into the `github-pages` gem. Meaning you can't use Minimal Mistakes as a Ruby gem there just yet... locally served or self-hosted installs should be fine if you don't mind using a pre-release version of Jekyll.

View File

@@ -1,16 +1,16 @@
---
title: "Gemified Theme -- Beta Release"
last_modified_at: 2016-11-03T11:45:04-04:00
last_modified_at: 2017-10-20T12:29:16-04:00
categories:
- Jekyll
tags:
- update
toc: true
toc_label: "Getting Started"
---
Hot on the heels of Jekyll v3.3.0 is a beta release of Minimal Mistakes... as a gemified theme.
{% include toc title="Getting Started" %}
[`minimal-mistakes-jekyll`](https://rubygems.org/gems/minimal-mistakes-jekyll) can only be used with Jekyll proper. If you're hosting on GitHub Pages or using that gem the theme won't work. 3rd party themes haven't been white-listed so it's a no go for now.
Fine with all that? Great. Let's continue.