@md-plugins/md-plugin-headers 0.1.0-alpha.11 → 0.1.0-alpha.13
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/dist/index.mjs +6 -8
- package/package.json +4 -6
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
const rControl = /[\u0000-\u001f]/g;
|
|
2
|
+
const rSpecial = /[\s~`!@#$%^&*()\-_+=[\]{}|\\;:"'“”‘’<>,.?/]+/g;
|
|
3
|
+
const rCombining = /[\u0300-\u036F]/g;
|
|
4
|
+
const andRE = /&/g;
|
|
5
|
+
const slugify = (str) => str.normalize("NFKD").toLowerCase().replace(andRE, "-and-").replace(rCombining, "").replace(rControl, "-").replace(rSpecial, "-").replace(/[^a-z0-9-]+/g, "").replace(/-{2,}/g, "-").replace(/^-+|-+$/g, "").replace(/^(\d)/, "_$1");
|
|
2
6
|
|
|
3
7
|
const titleRE = /<\/?[^>]+(>|$)/g;
|
|
4
8
|
const apiRE = /^<MarkdownApi /;
|
|
5
9
|
const apiNameRE = /(?:file|name)="([^"]+)"/;
|
|
6
|
-
const installationRE = /^<MarkdownInstallation(?:\s+title="([^"]*)")?\s*/;
|
|
7
10
|
const exampleRE = /^<MarkdownExample(?:\s+title="([^"]*)")?\s*/;
|
|
8
11
|
function parseContent(str, slugify$1 = slugify, format = (_str) => _str) {
|
|
9
12
|
const title = String(str).replace(titleRE, "").trim();
|
|
@@ -57,12 +60,7 @@ const headersPlugin = (md, {
|
|
|
57
60
|
env.toc.push({ id: slugify$1(title), title, deep: true });
|
|
58
61
|
}
|
|
59
62
|
}
|
|
60
|
-
|
|
61
|
-
if (match !== null) {
|
|
62
|
-
const title = match[1] ?? "Installation";
|
|
63
|
-
env.toc.push({ id: slugify$1(title), title, deep: true });
|
|
64
|
-
}
|
|
65
|
-
match = token.content.match(exampleRE);
|
|
63
|
+
const match = token.content.match(exampleRE);
|
|
66
64
|
if (match !== null) {
|
|
67
65
|
const title = match[1] ?? "Example";
|
|
68
66
|
env.toc.push({ id: slugify$1(title), title, deep: true });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@md-plugins/md-plugin-headers",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.13",
|
|
4
4
|
"description": "A markdown-it plugin for handling headers (H1-H6).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown-it",
|
|
@@ -32,12 +32,10 @@
|
|
|
32
32
|
"files": [
|
|
33
33
|
"./dist"
|
|
34
34
|
],
|
|
35
|
-
"dependencies": {
|
|
36
|
-
"markdown-it": "^14.1.0",
|
|
37
|
-
"@md-plugins/shared": "0.1.0-alpha.11"
|
|
38
|
-
},
|
|
39
35
|
"devDependencies": {
|
|
40
|
-
"
|
|
36
|
+
"markdown-it": "^14.1.0",
|
|
37
|
+
"@types/markdown-it": "^14.1.2",
|
|
38
|
+
"@md-plugins/shared": "0.1.0-alpha.13"
|
|
41
39
|
},
|
|
42
40
|
"peerDependencies": {
|
|
43
41
|
"markdown-it": "^14.1.0"
|