diff --git a/anchor-markdown-header.js b/anchor-markdown-header.js index 29e7531..cdb2bb5 100644 --- a/anchor-markdown-header.js +++ b/anchor-markdown-header.js @@ -21,6 +21,8 @@ function basicGithubId(text) { return text.replace(/ /g,'-') // escape codes .replace(/%([abcdef]|\d){2,2}/ig, '') + // link URLs are removed + .replace(/\[(.*)\]\(.*\)/, '$1') // single chars that are removed .replace(/[\/?!:\[\]`.,()*"';{}+=<>~\$|#@&–—]/g,'') // CJK punctuations that are removed diff --git a/test/anchor-markdown-header.js b/test/anchor-markdown-header.js index 895e934..747d671 100644 --- a/test/anchor-markdown-header.js +++ b/test/anchor-markdown-header.js @@ -49,6 +49,7 @@ test('\ngenerating anchor in github mode', function (t) { , [ '👷🏼‍♀️ Maintenance', null, '#%EF%B8%8F-maintenance'] , [ 'Alarm clock ⏰', null, '#alarm-clock-'] , [ 'Apple Watch ⌚️', null, '#apple-watch-%EF%B8%8F'] + , [ 'Remove Markdown links [`EventEmitter`](http://nodejs.org/api/events.html)', null, '#remove-markdown-links-eventemitter'] ].forEach(function (x) { check(x[0], x[1], x[2]) }); t.end(); })