Skip to content

Commit

Permalink
More underscore test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Moonbase59 committed Apr 2, 2024
1 parent 75a725d commit 13a216a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions gh-toc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, "-");

Expand Down
13 changes: 12 additions & 1 deletion testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 13a216a

Please sign in to comment.