-
-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from allejo/feature/no-toc-support
Add `.no_toc` support
- Loading branch information
Showing
3 changed files
with
74 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
# see https://github.com/allejo/jekyll-toc/issues/15 | ||
--- | ||
|
||
{% capture markdown %} | ||
# Contents header | ||
{:.no_toc} | ||
|
||
* A markdown unordered list which will be replaced with the ToC, excluding the "Contents header" from above | ||
{:toc} | ||
|
||
# H1 header | ||
|
||
## H2 header | ||
{% endcapture %} | ||
{% assign text = markdown | markdownify %} | ||
|
||
{% include toc.html html=text %} | ||
|
||
<!-- /// --> | ||
|
||
<ul> | ||
<li> | ||
<a href="#h1-header">H1 header</a> | ||
<ul> | ||
<li> | ||
<a href="#h2-header">H2 header</a> | ||
</li> | ||
</ul> | ||
</li> | ||
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
# If a heading has `no_toc` with other classes, it should still ignore it from | ||
# the TOC | ||
# see https://github.com/allejo/jekyll-toc/issues/15 | ||
--- | ||
|
||
{% capture markdown %} | ||
# Contents header | ||
{:.no_toc.another-class} | ||
|
||
* A markdown unordered list which will be replaced with the ToC, excluding the "Contents header" from above | ||
{:toc} | ||
|
||
# H1 header | ||
{:.custom-class} | ||
|
||
## H2 header | ||
{% endcapture %} | ||
{% assign text = markdown | markdownify %} | ||
|
||
{% include toc.html html=text %} | ||
|
||
<!-- /// --> | ||
|
||
<ul> | ||
<li> | ||
<a href="#h1-header">H1 header</a> | ||
<ul> | ||
<li> | ||
<a href="#h2-header">H2 header</a> | ||
</li> | ||
</ul> | ||
</li> | ||
</ul> |