Skip to content

Commit

Permalink
Remove all html tags from the GitHub's anchor tag.
Browse files Browse the repository at this point in the history
HTML tags should be removed from the GitHub's anchor tag. See below:

```
- [Heading test with<sup>HTML tags</sup>](#heading-test-withhtml-tags)
```

Closes thlorenz#40
  • Loading branch information
Sang-Kil Park authored and mcornella committed Sep 23, 2020
1 parent 7dac2fe commit 7ff6781
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions anchor-markdown-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ function basicGithubId(text) {
.replace(/\b[_*]|[_*]\b/g, '')
// link URLs are removed
.replace(/\[(.*)\]\(.*\)/, '$1')
// html tags that are removed
.replace(/(<([^>]+)>)/gi, '')
// single chars that are removed
.replace(/[\/?!:\[\]`.,()*"';{}+=<>~\$|#@&]/g,'')
// CJK punctuations that are removed
Expand Down
2 changes: 1 addition & 1 deletion test/anchor-markdown-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ test('\ngenerating anchor in github mode', function (t) {
, [ 'remove {curly braces}{}', null, '#remove-curly-braces'],
, [ 'remove ++++pluses+', null, '#remove-pluses']
, [ 'remove escape codes %3Cstatic%E3 coreappupevents %E2%86%92 object', null, '#remove-escape-codes-static-coreappupevents--object']
, [ 'remove lt and gt <static>mycall', null, '#remove-lt-and-gt-staticmycall']
, [ 'remove lt and gt <static>mycall', null, '#remove-lt-and-gt-mycall']
, [ 'remove exclamation point!', null, '#remove-exclamation-point']
, [ 'remove = sign', null, '#remove--sign']
, [ '`history [pgn | alg]`', null, '#history-pgn--alg']
Expand Down

0 comments on commit 7ff6781

Please sign in to comment.