Skip to content

Commit

Permalink
Merge pull request #10 from orion486/master
Browse files Browse the repository at this point in the history
Improves detection and removal of format characters from heading anchors
  • Loading branch information
imthenachoman authored Apr 10, 2024
2 parents 31180b2 + b654301 commit c49a5c4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion nGitHubTOC.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function tocIt(inputMD, minHeading, maxHeading, ignoreLinex)

headingLevel -= minHeading;

var headingAnchor = headingTitle.toLowerCase().replace(/[^_0-9a-z\xE0-\xFF- ]/g, "").replace(/_(?=.*)/g, "").replace(/\*(?=.*)/g, "").replace(/ /g, "-");
var headingAnchor = headingTitle.toLowerCase().replace(/[^_*0-9a-z\xE0-\xFF- ]/g, "").replace(/_{1,2}(.+?)_{1,2}/g, "$1").replace(/\*{1,3}(.+?)\*{1,3}/g, "$1").replace(/ /g, "-");

if(headingAnchor in anchorTracker)
{
Expand Down

0 comments on commit c49a5c4

Please sign in to comment.