From df3bb27e2006c0204c34d8519a35387dda28c14f Mon Sep 17 00:00:00 2001 From: W Zhang Date: Wed, 15 Jul 2020 15:54:43 +0100 Subject: [PATCH 1/2] Modified skipNoIDs logic in toc.html Now TOC entry will not be generated when skipNoIDs=true, in situations where some HTML with an id exist between two headers. Its corresponding unit test `_tests/sktipHeadingsWithNoIDs.md` was modified accordingly. --- _includes/toc.html | 8 ++------ _tests/skipHeadingsWithNoIDs.md | 1 + 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/_includes/toc.html b/_includes/toc.html index 73d42ee..0c65a9b 100644 --- a/_includes/toc.html +++ b/_includes/toc.html @@ -67,12 +67,6 @@ {% continue %} {% endif %} - {% if skipNoIDs == true %} - {% unless node contains "id=" %} - {% continue %} - {% endunless %} - {% endif %} - {% assign headerLevel = node | replace: '"', '' | slice: 0, 1 | times: 1 %} {% if headerLevel < minHeader or headerLevel > maxHeader %} @@ -116,6 +110,8 @@ {% if html_id %} {% capture list_item %}[{{ anchor_body }}]({% if include.baseurl %}{{ include.baseurl }}{% endif %}#{{ html_id }}){% endcapture %} + {% elsif skipNoIDs == true %} + {% continue %} {% else %} {% capture list_item %}{{ anchor_body }}{% endcapture %} {% endif %} diff --git a/_tests/skipHeadingsWithNoIDs.md b/_tests/skipHeadingsWithNoIDs.md index 7084c80..591d7fe 100644 --- a/_tests/skipHeadingsWithNoIDs.md +++ b/_tests/skipHeadingsWithNoIDs.md @@ -8,6 +8,7 @@

My Awesome Example Page

With an awesome subtitle

+ Dummy Link
### Known Problems From 03b6e6c3129d6a6fafd6475c603e58457e024c7a Mon Sep 17 00:00:00 2001 From: Vladimir Jimenez Date: Sun, 19 Jul 2020 15:48:14 -0700 Subject: [PATCH 2/2] Update _tests/skipHeadingsWithNoIDs.md --- _tests/skipHeadingsWithNoIDs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_tests/skipHeadingsWithNoIDs.md b/_tests/skipHeadingsWithNoIDs.md index 591d7fe..e90cd7f 100644 --- a/_tests/skipHeadingsWithNoIDs.md +++ b/_tests/skipHeadingsWithNoIDs.md @@ -8,7 +8,7 @@

My Awesome Example Page

With an awesome subtitle

- Dummy Link + Dummy Link
### Known Problems