From 8dd14131e6e6c16eff711c55dbc546ca95d13c54 Mon Sep 17 00:00:00 2001 From: Vladimir Jimenez Date: Mon, 18 May 2020 22:10:02 -0700 Subject: [PATCH 1/2] Don't assign firstHeader if headers are skipped --- _includes/toc.html | 12 +++++----- _tests/noTocForFirstHeading copy.md | 37 +++++++++++++++++++++++++++++ _tests/noTocForFirstHeading.md | 25 +++++++++++++++++++ 3 files changed, 68 insertions(+), 6 deletions(-) create mode 100644 _tests/noTocForFirstHeading copy.md create mode 100644 _tests/noTocForFirstHeading.md diff --git a/_includes/toc.html b/_includes/toc.html index 6971739..3660ad4 100644 --- a/_includes/toc.html +++ b/_includes/toc.html @@ -55,12 +55,6 @@ {% continue %} {% endif %} - {% if firstHeader %} - {% assign firstHeader = false %} - {% assign minHeader = headerLevel %} - {% endif %} - - {% assign indentAmount = headerLevel | minus: minHeader %} {% assign _workspace = node | split: 'Subheading A +
  • Subheading B
  • +
  • Subheading C
  • + diff --git a/_tests/noTocForFirstHeading.md b/_tests/noTocForFirstHeading.md new file mode 100644 index 0000000..dba5bd3 --- /dev/null +++ b/_tests/noTocForFirstHeading.md @@ -0,0 +1,25 @@ +--- +# See https://github.com/allejo/jekyll-toc/issues/35 +--- + +{% capture markdown %} +## some prominent header i want to hide +{: .no_toc} + +### Subheading A + +### Subheading B + +### Subheading C +{% endcapture %} +{% assign text = markdown | markdownify %} + +{% include toc.html html=text %} + + + + From 47f865e8da58246e7f605387b66a3f61e5fd6bdf Mon Sep 17 00:00:00 2001 From: Vladimir Jimenez Date: Mon, 18 May 2020 22:13:47 -0700 Subject: [PATCH 2/2] Version bump to 1.0.12 --- _includes/toc.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_includes/toc.html b/_includes/toc.html index 3660ad4..5090156 100644 --- a/_includes/toc.html +++ b/_includes/toc.html @@ -1,6 +1,6 @@ {% capture tocWorkspace %} {% comment %} - Version 1.0.11 + Version 1.0.12 https://github.com/allejo/jekyll-toc "...like all things liquid - where there's a will, and ~36 hours to spare, there's usually a/some way" ~jaybe