fix(subParsers): strip international punctuation from github headers (#950)

This commit is contained in:
Barry Pollard 2022-11-14 18:47:36 +00:00 committed by GitHub
parent e4c87cf5d5
commit 4333646c8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -140,7 +140,7 @@ showdown.subParser('makehtml.heading.id', function (m, options, globals) {
.replace(/¨D/g, '') .replace(/¨D/g, '')
// replace rest of the chars (&~$ are repeated as they might have been escaped) // replace rest of the chars (&~$ are repeated as they might have been escaped)
// borrowed from github's redcarpet (so they should produce similar results) // borrowed from github's redcarpet (so they should produce similar results)
.replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g, '') .replace(/[&+$,\/:;=?@"#{}|^¨¿?:~\[\]`、゠=…‥『』〝〟「」゠=…‥\\*(){}()[]【】%.。,¡!'<>]/g, '')
.toLowerCase(); .toLowerCase();
} else if (options.rawHeaderId) { } else if (options.rawHeaderId) {
title = title title = title

View File

@ -1,3 +1,3 @@
<h1 id="some-header">some header</h1> <h1 id="some-header">some header</h1>
<h1 id="some-header-with--chars">some header with &amp;+$,/:;=?@\"#{}|^~[]`\*()%.!' chars</h1> <h1 id="some-header-with--chars">some header with &amp;+$,/:;=?@\"#{}|^¨¿?:~[]`゠=…‥『』〝〟「」\*(){}()[]【】%.。,¡!' chars</h1>
<h1 id="another-header--with--chars">another header &gt; with &lt; chars</h1> <h1 id="another-header--with--chars">another header &gt; with &lt; chars</h1>

View File

@ -1,5 +1,5 @@
# some header # some header
# some header with &+$,/:;=?@\"#{}|^~[]`\\*()%.!' chars # some header with &+$,/:;=?@\"#{}|^¨¿?:~[]`゠=…‥『』〝〟「」\\*(){}()[]【】%.。,¡!' chars
# another header > with < chars # another header > with < chars