diff --git a/gh-toc.js b/gh-toc.js index f871fb2..16edeb4 100644 --- a/gh-toc.js +++ b/gh-toc.js @@ -39,6 +39,9 @@ function tocIt(inputMD, minHeading, maxHeading, ignoreLinex) headingAnchor = headingAnchor.replace(/[^\p{L}\p{Nd}\p{Nl}\s_-]/gu, ""); // remove sequences of * headingAnchor = headingAnchor.replace(/\*(?=.*)/gu, ""); + // TODO: Find a good way to keep underscores, except those for Markdown italics + // Right now, we’re just keeping underscores + // replace remaining blanks with '-' headingAnchor = headingAnchor.replace(/ /gu, "-"); diff --git a/testing.md b/testing.md index 1093b97..46d8b29 100644 --- a/testing.md +++ b/testing.md @@ -9,7 +9,18 @@ Let’s check if these coincide with whatever GitHub Markdown comes up with! ## Specials ### Some `code_with_underscores += a*b` -### Just __ some underlines, or __dunders__ +### More `code_bars` + +### Underscore stuff +#### Just __ some underlines, or __dunders__ +#### ___ +#### __ +#### __dunder__ +#### _emphasis_ +#### _ emph _ +#### _in a *sentence*_ +#### _in_word_parsing_ + ### Some _emphasized_ text ### Some **bold** text ### Some ~~strikethrough~ text