Skip to content

Commit 9ccc369

Browse files
Bwkolunny
authored andcommitted
Fix wrong anchors for non-latin headings (#3981) (#512)
Change Javascript regular expression to match non-latin characters The regex comes from here: http://stackoverflow.com/questions/150033/regular-expression-to-match-non-english-characters#comment22322603_150078 And this patch should fixed these two issues: #3919 #3843
1 parent 6e5fffb commit 9ccc369

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

public/js/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1347,7 +1347,7 @@ $(document).ready(function () {
13471347
var headers = {};
13481348
$(this).find('h1, h2, h3, h4, h5, h6').each(function () {
13491349
var node = $(this);
1350-
var val = encodeURIComponent(node.text().toLowerCase().replace(/[^\w\- ]/g, '').replace(/[ ]/g, '-'));
1350+
var val = encodeURIComponent(node.text().toLowerCase().replace(/[^\u00C0-\u1FFF\u2C00-\uD7FF\w\- ]/g, '').replace(/[ ]/g, '-'));
13511351
var name = val;
13521352
if (headers[val] > 0) {
13531353
name = val + '-' + headers[val];

0 commit comments

Comments
 (0)