You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Toggle table of contents via front matter (mmistakes#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
Closemmistakes#1222
- Add support for Staticman v2 endpoint and reCAPTCHA.
13
13
- Add Polish localized UI text strings. [#1304](https://github.com/mmistakes/minimal-mistakes/pull/1304)
14
+
- Add toggleable table of contents via YAML Front Matter. Note: `toc` helper include will be deprecated in next major version. [#1222](https://github.com/mmistakes/minimal-mistakes/issues/1222)
Copy file name to clipboardexpand all lines: README.md
+6-2
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ Minimal Mistakes is a flexible two-column Jekyll theme. Perfect for hosting your
22
22
- Several responsive layout options (single, archive index, splash, and paginated home page).
23
23
- Optimized for search engines with support for [Twitter Cards](https://dev.twitter.com/cards/overview) and [Open Graph](http://ogp.me/) data
24
24
- Optional [header images](https://mmistakes.github.io/minimal-mistakes/docs/layouts/#headers), [custom sidebars](https://mmistakes.github.io/minimal-mistakes/docs/layouts/#sidebars), [table of contents](https://mmistakes.github.io/minimal-mistakes/docs/helpers/#table-of-contents), [galleries](https://mmistakes.github.io/minimal-mistakes/docs/helpers/#gallery), related posts, [breadcrumb links](https://mmistakes.github.io/minimal-mistakes/docs/configuration/#breadcrumb-navigation-beta), [navigation lists](https://mmistakes.github.io/minimal-mistakes/docs/helpers/#navigation-list), and more.
25
-
- Commenting support (powered by [Disqus](https://disqus.com/), [Facebook](https://developers.facebook.com/docs/plugins/comments), Google+, [Discourse](https://www.discourse.org/), static-based via [Staticman v1](https://staticman.net/), and custom).
25
+
- Commenting support (powered by [Disqus](https://disqus.com/), [Facebook](https://developers.facebook.com/docs/plugins/comments), Google+, [Discourse](https://www.discourse.org/), static-based via [Staticman v1 and v2](https://staticman.net/), and custom).
- UI localized text in English (default), Brazilian Portuguese (Português brasileiro), Chinese, Danish, Dutch, French (Français), German (Deutsch), Greek, Indonesian, Italian (Italiano), Korean, Nepali (Nepalese), Polish, Russian, Spanish (Español), Swedish, Turkish (Türkçe), and Vietnamese.
28
28
@@ -206,4 +206,8 @@ GreedyNav.js is distributed under the terms of the [MIT License](http://opensour
"...like all things liquid - where there's a will, and ~36 hours to spare, there's usually a/some way" ~jaybe
4
+
5
+
Usage:
6
+
{% include toc.html html=content sanitize=true class="inline_toc" id="my_toc" h_min=2 h_max=3 %}
7
+
8
+
Parameters:
9
+
* html (string) - the HTML of compiled markdown generated by kramdown in Jekyll
10
+
11
+
Optional Parameters:
12
+
* sanitize (bool) : false - when set to true, the headers will be stripped of any HTML in the TOC
13
+
* class (string) : '' - a CSS class assigned to the TOC
14
+
* id (string) : '' - an ID to assigned to the TOC
15
+
* h_min (int) : 1 - the minimum TOC header level to use; any header lower than this value will be ignored
16
+
* h_max (int) : 6 - the maximum TOC header level to use; any header greater than this value will be ignored
17
+
18
+
Output:
19
+
An unordered list representing the table of contents of a markdown block. This snippet will only generate the table of contents and will NOT output the markdown given to it
Copy file name to clipboardexpand all lines: docs/_docs/01-quick-start-guide.md
+2-3
Original file line number
Diff line number
Diff line change
@@ -2,15 +2,14 @@
2
2
title: "Quick-Start Guide"
3
3
permalink: /docs/quick-start-guide/
4
4
excerpt: "How to quickly install and setup Minimal Mistakes for use with GitHub Pages."
5
-
last_modified_at: 2017-09-21T16:24:15-04:00
5
+
last_modified_at: 2017-10-20T12:34:04-04:00
6
6
redirect_from:
7
7
- /theme-setup/
8
+
toc: true
8
9
---
9
10
10
11
Minimal Mistakes has been developed as a [Jekyll theme gem](http://jekyllrb.com/docs/themes/) for easier use. It is also 100% compatible with GitHub Pages --- just with a more involved installation process.
11
12
12
-
{% include toc %}
13
-
14
13
## Installing the Theme
15
14
16
15
If you're running Jekyll v3.5+ and self-hosting you can quickly install the theme as a Ruby gem. If you're hosting with GitHub Pages you'll have to use the old "repo fork" method or directly copy all of the theme files[^structure] into your site.
Copy file name to clipboardexpand all lines: docs/_docs/05-configuration.md
+2-3
Original file line number
Diff line number
Diff line change
@@ -2,13 +2,12 @@
2
2
title: "Configuration"
3
3
permalink: /docs/configuration/
4
4
excerpt: "Settings for configuring and customizing the theme."
5
-
last_modified_at: 2017-10-04T16:31:28-04:00
5
+
last_modified_at: 2017-10-20T12:34:20-04:00
6
+
toc: true
6
7
---
7
8
8
9
Settings that affect your entire site can be changed in [Jekyll's configuration file](https://jekyllrb.com/docs/configuration/): `_config.yml`, found in the root of your project. If you don't have this file you'll need to copy or create one using the theme's [default `_config.yml`](https://github.com/mmistakes/minimal-mistakes/blob/master/_config.yml) as a base.
9
10
10
-
{% include toc %}
11
-
12
11
**Note:** for technical reasons, `_config.yml` is NOT reloaded automatically when used with `jekyll serve`. If you make any changes to this file, please restart the server process for them to be applied.
alt: "single layout with comments and related posts"
10
-
last_modified_at: 2017-07-05T15:41:36-04:00
10
+
last_modified_at: 2017-10-20T14:26:10-04:00
11
+
toc: true
12
+
toc_label: "Included Layouts"
13
+
toc_icon: "columns"
11
14
---
12
15
13
-
{% include toc icon="columns" title="Included Layouts" %}
14
-
15
16
The bread and butter of any theme. Below you'll find the layouts included with Minimal Mistakes, what they look like and the type of content they've been built for.
16
17
17
18
## Default Layout
@@ -83,6 +84,28 @@ The layout you'll likely use the most --- sidebar and main content combo.
83
84
84
85
Assign with `layout: single`, or better yet apply as a [Front Matter default]({{ "/docs/configuration/#front-matter-defaults" | absolute_url }}) in `_config.yml`.
85
86
87
+
### Table of Contents
88
+
89
+
Auto-generated table of contents list for your posts and pages can be enabled by adding `toc: true` to the YAML Front Matter.
90
+
91
+

92
+
93
+
| Parameter | Required | Description | Default |
94
+
| --------- | -------- | ----------- | ------- |
95
+
|**toc**| Optional | Show table of contents. (boolean) |`false`|
96
+
|**toc_label**| Optional | Table of contents title. (string) |`toc_label` in UI Text data file. |
97
+
|**toc_icon**| Optional | Table of contents icon, displays before the title. (string) |[Font Awesome](https://fortawesome.github.io/Font-Awesome/icons/) <iclass="fa fa-file-text"></i> **file-text** icon. Any other FA icon can be used instead. |
98
+
99
+
**TOC example with custom title and icon**
100
+
101
+
```yaml
102
+
---
103
+
toc: true
104
+
toc_label: "My Table of Contents"
105
+
toc_icon: "gear"
106
+
---
107
+
```
108
+
86
109
## Archive Layout
87
110
88
111
Essentially the same as `single` with markup adjustments and some modules removed.
excerpt: "This is some sample content that goes here with **Markdown** formatting."
33
-
last_modified_at: 2017-05-16T11:45:00-04:00
33
+
last_modified_at: 2017-10-20T14:20:36-04:00
34
+
toc: true
35
+
toc_label: "Helpers"
36
+
toc_icon: "gears"
34
37
---
35
38
36
-
{% include toc icon="gears" title="Helpers" %}
37
-
38
39
You can think of these Jekyll helpers as little shortcuts. Since GitHub Pages doesn't allow most plugins --- [custom tags](https://jekyllrb.com/docs/plugins/#tags) are out. Instead the theme leverages [**includes**](https://jekyllrb.com/docs/templates/#includes) to do something similar.
39
40
40
41
## Base Path
@@ -238,18 +239,51 @@ header:
238
239
239
240
## Table of Contents
240
241
241
-
To include an [auto-generated table of contents](https://kramdown.gettalong.org/converter/html.html#toc) for posts and pages, add the following helper before any actual content in your post or page.
242
+
Auto-generated table of contents list for your posts and pages can be enabled using two methods.
243
+
244
+

245
+
246
+
### Enabled via YAML Front Matter
247
+
248
+
Add `toc: true` to the YAML Front Matter of any post or page.
249
+
250
+
| Parameter | Required | Description | Default |
251
+
| --------- | -------- | ----------- | ------- |
252
+
| **toc** | Optional | Show table of contents. (boolean) | `false` |
253
+
| **toc_label** | Optional | Table of contents title. (string) | `toc_label` in UI Text data file. |
254
+
| **toc_icon** | Optional | Table of contents icon, displays before the title. (string) | [Font Awesome](https://fortawesome.github.io/Font-Awesome/icons/) <i class="fa fa-file-text"></i> **file-text** icon. Any other FA icon can be used instead. |
255
+
256
+
**TOC example with custom title and icon**
257
+
258
+
```yaml
259
+
---
260
+
toc: true
261
+
toc_label: "My Table of Contents"
262
+
toc_icon: "gear"
263
+
---
264
+
```
265
+
266
+
**Note:** using both methods will have unintended results. Be sure to remove `{% raw %}{% include toc %}{% endraw %}` placed table of contents from your content when using `toc: true`.
267
+
{: .notice--warning }
268
+
269
+
### Enabled via `toc` include (deprecated)
270
+
271
+
To include a Kramdown [auto-generated table of contents](https://kramdown.gettalong.org/converter/html.html#toc) for posts and pages, add the following helper to your content.
242
272
243
273
```liquid
244
274
{% raw %}{% include toc %}{% endraw %}
245
275
```
246
276
247
-

277
+
**Note:** this method only works with Markdown files.
278
+
{: .notice--warning}
279
+
280
+
**Deprecated:** `toc` helper will be removed in the next major version of the theme. It is encouraged that you migrate to the YAML Front Matter method above.
281
+
{: .notice--danger}
248
282
249
283
| Parameter | Required | Description | Default |
250
284
| --------- | -------- | ----------- | ------- |
251
-
| **title** | Optional | Table of contents title. | `toc_label` in UI Text data file. |
252
-
| **icon** | Optional | Table of contents icon (shows before the title). | [Font Awesome](https://fortawesome.github.io/Font-Awesome/icons/) <i class="fa fa-file-text"></i> **file-text** icon. Any other FA icon can be used instead. |
285
+
| **title** | Optional | Table of contents title. (string) | `toc_label` in UI Text data file. |
286
+
| **icon** | Optional | Table of contents icon, displays before the title. (string) | [Font Awesome](https://fortawesome.github.io/Font-Awesome/icons/) <i class="fa fa-file-text"></i> **file-text** icon. Any other FA icon can be used instead. |
Copy file name to clipboardexpand all lines: docs/_docs/15-utility-classes.md
+4-3
Original file line number
Diff line number
Diff line change
@@ -2,11 +2,12 @@
2
2
title: "Utility Classes"
3
3
permalink: /docs/utility-classes/
4
4
excerpt: "CSS classes for aligning text/image, styling buttons and notices, and more."
5
-
last_modified_at: 2017-09-01T11:54:44-04:00
5
+
last_modified_at: 2017-10-20T12:36:34-04:00
6
+
toc: true
7
+
toc_label: "Utility Classes"
8
+
toc_icon: "gears"
6
9
---
7
10
8
-
{% include toc icon="gears" title="Utility Classes" %}
9
-
10
11
Using the Kramdown Markdown renderer with Jekyll allows you to add [block](http://kramdown.gettalong.org/quickref.html#block-attributes) and [inline attributes](http://kramdown.gettalong.org/quickref.html#inline-attributes). This is nice if you want to add custom styling to text and image, and still write in Markdown.
11
12
12
13
**Jekyll 3:** Kramdown is the default for `jekyll new` sites and those hosted on GitHub Pages. Not using Kramdown? That's OK. The following classes are still available when used with standard HTML.
- Add support for Staticman v2 endpoint and reCAPTCHA.
22
23
- Add Polish localized UI text strings. [#1304](https://github.com/mmistakes/minimal-mistakes/pull/1304)
24
+
- Add toggleable table of contents via YAML Front Matter. Note: `toc` helper include will be deprecated in next major version. [#1222](https://github.com/mmistakes/minimal-mistakes/issues/1222)
Copy file name to clipboardexpand all lines: docs/_docs/20-docs-2-2.md
+2-3
Original file line number
Diff line number
Diff line change
@@ -2,11 +2,10 @@
2
2
title: "2.2 Documentation"
3
3
permalink: /docs/docs-2-2/
4
4
excerpt: "Setup and installation instructions for Minimal Mistakes 2.2 (deprecated)."
5
-
last_modified_at: 2016-04-13T15:54:02-04:00
5
+
last_modified_at: 2017-10-20T12:37:11-04:00
6
+
toc: true
6
7
---
7
8
8
-
{% include toc %}
9
-
10
9
## Installation
11
10
12
11
Minimal Mistakes now requires [Jekyll](http://jekyllrb.com/) 3.0. Make sure to run `bundle update` if you aren't on the latest version to update all gem dependencies.
"...like all things liquid - where there's a will, and ~36 hours to spare, there's usually a/some way" ~jaybe
4
+
5
+
Usage:
6
+
{% include toc.html html=content sanitize=true class="inline_toc" id="my_toc" h_min=2 h_max=3 %}
7
+
8
+
Parameters:
9
+
* html (string) - the HTML of compiled markdown generated by kramdown in Jekyll
10
+
11
+
Optional Parameters:
12
+
* sanitize (bool) : false - when set to true, the headers will be stripped of any HTML in the TOC
13
+
* class (string) : '' - a CSS class assigned to the TOC
14
+
* id (string) : '' - an ID to assigned to the TOC
15
+
* h_min (int) : 1 - the minimum TOC header level to use; any header lower than this value will be ignored
16
+
* h_max (int) : 6 - the maximum TOC header level to use; any header greater than this value will be ignored
17
+
18
+
Output:
19
+
An unordered list representing the table of contents of a markdown block. This snippet will only generate the table of contents and will NOT output the markdown given to it
Copy file name to clipboardexpand all lines: docs/_pages/about.md
+9-6
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,8 @@ layouts_gallery:
12
12
- url: /assets/images/mm-layout-archive.png
13
13
image_path: /assets/images/mm-layout-archive.png
14
14
alt: "archive layout example"
15
-
last_modified_at: 2017-10-16T12:43:05-04:00
15
+
last_modified_at: 2017-10-20T12:43:30-04:00
16
+
toc: true
16
17
---
17
18
18
19
Minimal Mistakes is a flexible two-column Jekyll theme. Perfect for hosting your personal site, blog, or portfolio on GitHub or self-hosting on your own server. As the name implies --- styling is purposely minimalistic to be enhanced and customized by you :smile:.
@@ -23,12 +24,14 @@ Minimal Mistakes is a flexible two-column Jekyll theme. Perfect for hosting your
23
24
24
25
## Notable Features
25
26
26
-
- Compatible with Jekyll 3.x and GitHub Pages
27
-
- Support for Jekyll's built-in Sass/SCSS preprocessor
28
-
- Several responsive layout options (single, archive index, splash, and paginated home page)
29
-
- SEO optimized with support for [Twitter Cards](https://dev.twitter.com/cards/overview) and [Open Graph](http://ogp.me/) data
27
+
- Bundled as a "theme gem" for easier install/upgrading.
28
+
- Compatible with GitHub Pages.
29
+
- Support for Jekyll's built-in Sass/SCSS preprocessor.
30
+
- Seven different skins (color variations).
31
+
- Several responsive layout options (single, archive index, splash, and paginated home page).
32
+
- Optimized for search engines with support for [Twitter Cards](https://dev.twitter.com/cards/overview) and [Open Graph](http://ogp.me/) data
30
33
- Optional [header images](https://mmistakes.github.io/minimal-mistakes/docs/layouts/#headers), [custom sidebars](https://mmistakes.github.io/minimal-mistakes/docs/layouts/#sidebars), [table of contents](https://mmistakes.github.io/minimal-mistakes/docs/helpers/#table-of-contents), [galleries](https://mmistakes.github.io/minimal-mistakes/docs/helpers/#gallery), related posts, [breadcrumb links](https://mmistakes.github.io/minimal-mistakes/docs/configuration/#breadcrumb-navigation-beta), [navigation lists](https://mmistakes.github.io/minimal-mistakes/docs/helpers/#navigation-list), and more.
31
-
- Commenting support (powered by [Disqus](https://disqus.com/), [Facebook](https://developers.facebook.com/docs/plugins/comments), Google+, [Discourse](https://www.discourse.org/), static-based via [Staticman](https://staticman.net/), and custom).
34
+
- Commenting support (powered by [Disqus](https://disqus.com/), [Facebook](https://developers.facebook.com/docs/plugins/comments), Google+, [Discourse](https://www.discourse.org/), static-based via [Staticman v1 and v2](https://staticman.net/), and custom).
- UI localized text in English (default), Brazilian Portuguese (Português brasileiro), Chinese, Danish, Dutch, French (Français), German (Deutsch), Greek, Indonesian, Italian (Italiano), Korean, Nepali (Nepalese), Polish, Russian, Spanish (Español), Swedish, Turkish (Türkçe), and Vietnamese.
Copy file name to clipboardexpand all lines: docs/_pages/terms.md
+2-3
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,10 @@
1
1
---
2
2
permalink: /terms/
3
3
title: "Terms and Privacy Policy"
4
-
last_modified_at: 2016-11-03T11:57:46-04:00
4
+
last_modified_at: 2017-10-20T12:42:38-04:00
5
+
toc: true
5
6
---
6
7
7
-
{% include toc %}
8
-
9
8
## Privacy Policy
10
9
11
10
The privacy of my visitors is extremely important. This Privacy Policy outlines the types of personal information that is received and collected and how it is used.
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
Copy file name to clipboardexpand all lines: docs/_posts/2016-09-21-gemified-theme-alpha.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,16 @@
1
1
---
2
2
title: "Gemified Theme -- Alpha Release"
3
-
last_modified_at: 2016-11-03T11:46:00-04:00
3
+
last_modified_at: 2017-10-20T12:29:34-04:00
4
4
categories:
5
5
- Jekyll
6
6
tags:
7
7
- update
8
+
toc: true
9
+
toc_label: "Getting Started"
8
10
---
9
11
10
12
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".
11
13
12
-
{% include toc title="Getting Started" %}
13
-
14
14
If you're interested in testing out Minimal Mistakes as a gemified theme read on. There are a few caveats though:
15
15
16
16
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.
Copy file name to clipboardexpand all lines: docs/_posts/2016-10-06-gemified-theme-beta.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,16 @@
1
1
---
2
2
title: "Gemified Theme -- Beta Release"
3
-
last_modified_at: 2016-11-03T11:45:04-04:00
3
+
last_modified_at: 2017-10-20T12:29:16-04:00
4
4
categories:
5
5
- Jekyll
6
6
tags:
7
7
- update
8
+
toc: true
9
+
toc_label: "Getting Started"
8
10
---
9
11
10
12
Hot on the heels of Jekyll v3.3.0 is a beta release of Minimal Mistakes... as a gemified theme.
11
13
12
-
{% include toc title="Getting Started" %}
13
-
14
14
[`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.
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]
0 commit comments