@mdit-vue/shared 0.7.1 → 0.9.1
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.cjs +11 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +11 -3
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -10,7 +10,10 @@ const htmlEscapeMap = {
|
|
|
10
10
|
'"': """
|
|
11
11
|
};
|
|
12
12
|
const htmlEscapeRegexp = /[&<>'"]/g;
|
|
13
|
-
const htmlEscape = (str) => str.replace(
|
|
13
|
+
const htmlEscape = (str) => str.replace(
|
|
14
|
+
htmlEscapeRegexp,
|
|
15
|
+
(char) => htmlEscapeMap[char]
|
|
16
|
+
);
|
|
14
17
|
|
|
15
18
|
const htmlUnescapeMap = {
|
|
16
19
|
"&": "&",
|
|
@@ -25,7 +28,10 @@ const htmlUnescapeMap = {
|
|
|
25
28
|
""": '"'
|
|
26
29
|
};
|
|
27
30
|
const htmlUnescapeRegexp = /&(amp|#38|lt|#60|gt|#62|apos|#39|quot|#34);/g;
|
|
28
|
-
const htmlUnescape = (str) => str.replace(
|
|
31
|
+
const htmlUnescape = (str) => str.replace(
|
|
32
|
+
htmlUnescapeRegexp,
|
|
33
|
+
(char) => htmlUnescapeMap[char]
|
|
34
|
+
);
|
|
29
35
|
|
|
30
36
|
const resolveTitleFromToken = (token, { shouldAllowHtml, shouldEscapeText }) => {
|
|
31
37
|
const children = token.children ?? [];
|
|
@@ -33,7 +39,9 @@ const resolveTitleFromToken = (token, { shouldAllowHtml, shouldEscapeText }) =>
|
|
|
33
39
|
if (shouldAllowHtml) {
|
|
34
40
|
titleTokenTypes.push("html_inline");
|
|
35
41
|
}
|
|
36
|
-
const titleTokens = children.filter(
|
|
42
|
+
const titleTokens = children.filter(
|
|
43
|
+
(item) => titleTokenTypes.includes(item.type) && !item.meta?.isPermalinkSymbol
|
|
44
|
+
);
|
|
37
45
|
return titleTokens.reduce((result, item) => {
|
|
38
46
|
if (shouldEscapeText) {
|
|
39
47
|
if (item.type === "code_inline" || item.type === "text") {
|
package/dist/index.d.ts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -6,7 +6,10 @@ const htmlEscapeMap = {
|
|
|
6
6
|
'"': """
|
|
7
7
|
};
|
|
8
8
|
const htmlEscapeRegexp = /[&<>'"]/g;
|
|
9
|
-
const htmlEscape = (str) => str.replace(
|
|
9
|
+
const htmlEscape = (str) => str.replace(
|
|
10
|
+
htmlEscapeRegexp,
|
|
11
|
+
(char) => htmlEscapeMap[char]
|
|
12
|
+
);
|
|
10
13
|
|
|
11
14
|
const htmlUnescapeMap = {
|
|
12
15
|
"&": "&",
|
|
@@ -21,7 +24,10 @@ const htmlUnescapeMap = {
|
|
|
21
24
|
""": '"'
|
|
22
25
|
};
|
|
23
26
|
const htmlUnescapeRegexp = /&(amp|#38|lt|#60|gt|#62|apos|#39|quot|#34);/g;
|
|
24
|
-
const htmlUnescape = (str) => str.replace(
|
|
27
|
+
const htmlUnescape = (str) => str.replace(
|
|
28
|
+
htmlUnescapeRegexp,
|
|
29
|
+
(char) => htmlUnescapeMap[char]
|
|
30
|
+
);
|
|
25
31
|
|
|
26
32
|
const resolveTitleFromToken = (token, { shouldAllowHtml, shouldEscapeText }) => {
|
|
27
33
|
const children = token.children ?? [];
|
|
@@ -29,7 +35,9 @@ const resolveTitleFromToken = (token, { shouldAllowHtml, shouldEscapeText }) =>
|
|
|
29
35
|
if (shouldAllowHtml) {
|
|
30
36
|
titleTokenTypes.push("html_inline");
|
|
31
37
|
}
|
|
32
|
-
const titleTokens = children.filter(
|
|
38
|
+
const titleTokens = children.filter(
|
|
39
|
+
(item) => titleTokenTypes.includes(item.type) && !item.meta?.isPermalinkSymbol
|
|
40
|
+
);
|
|
33
41
|
return titleTokens.reduce((result, item) => {
|
|
34
42
|
if (shouldEscapeText) {
|
|
35
43
|
if (item.type === "code_inline" || item.type === "text") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mdit-vue/shared",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "Shared utils and types of mdit-vue",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown-it",
|
|
@@ -36,17 +36,17 @@
|
|
|
36
36
|
"test": "vitest"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@mdit-vue/types": "0.
|
|
39
|
+
"@mdit-vue/types": "0.9.0",
|
|
40
40
|
"@types/markdown-it": "^12.2.3",
|
|
41
41
|
"markdown-it": "^13.0.1"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"c8": "^7.12.0",
|
|
45
45
|
"unbuild": "^0.7.6",
|
|
46
|
-
"vitest": "^0.
|
|
46
|
+
"vitest": "^0.19.1"
|
|
47
47
|
},
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "8f7879b6a317cbae2f28d7f5cf563715387f7089"
|
|
52
52
|
}
|