Browse Source

Add support for Unicode chars when detect headings IDs (#4086)

main
Alexey Pyltsyn 3 years ago
committed by GitHub
parent
commit
5c1f51316f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      beta/plugins/remark-header-custom-ids.js

2
beta/plugins/remark-header-custom-ids.js

@ -32,7 +32,7 @@ module.exports = ({
visit(tree, 'heading', (node) => {
// Support custom-id syntax.
const rawHeader = toString(node);
const match = /^.+(\s*\{#([a-z0-9\-_]+?)\}\s*)$/.exec(rawHeader);
const match = /^.+(\s*\{#([\p{L}0-9\-_]+?)\}\s*)$/u.exec(rawHeader);
const id = match ? match[2] : slugs.slug(rawHeader, maintainCase);
if (match) {
// Remove the custom ID part from the text node.

Loading…
Cancel
Save