@ozdao/scriptorium 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/content/markdown.js +5 -1
package/package.json
CHANGED
package/src/content/markdown.js
CHANGED
|
@@ -32,10 +32,14 @@ const control_characters = /[\u0000-\u001f]/g;
|
|
|
32
32
|
const special_characters = /[\s~`!@#$%^&*()\-_+=[\]{}|\\;:"'“”‘’<>,.?/]+/g;
|
|
33
33
|
const combining_marks = /[̀-ͯ]/g;
|
|
34
34
|
|
|
35
|
+
// Диакритика снимается только с латиницы (é → e), как у VitePress. Кириллица
|
|
36
|
+
// остаётся целой: «й» и «ё» — отдельные буквы, а не «и» и «е» с надстрочным
|
|
37
|
+
// знаком; без NFC обратно якорь «#семейства» не совпадал бы с заголовком.
|
|
35
38
|
function slugify(text) {
|
|
36
39
|
return text
|
|
37
40
|
.normalize('NFKD')
|
|
38
|
-
.replace(combining_marks, '')
|
|
41
|
+
.replace(new RegExp(`(?<=[A-Za-z])${combining_marks.source}+`, 'g'), '')
|
|
42
|
+
.normalize('NFC')
|
|
39
43
|
.replace(control_characters, '')
|
|
40
44
|
.replace(special_characters, '-')
|
|
41
45
|
.replace(/-{2,}/g, '-')
|