@xsynaptic/unified-tools 3.0.3 → 4.2.0
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/html-cjk.mjs +1 -1
- package/dist/html.mjs +1 -1
- package/dist/markdown.mjs +1 -1
- package/dist/mdx.mjs +1 -1
- package/dist/text.mjs +1 -1
- package/package.json +8 -8
- package/src/html-cjk.ts +12 -3
- /package/dist/{dist-3QjHu5Qa.mjs → dist-Dfh4058I.mjs} +0 -0
package/dist/html-cjk.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./dist-
|
|
1
|
+
import{t as e}from"./dist-Dfh4058I.mjs";import t from"rehype-parse";import n from"rehype-sanitize";import r from"rehype-stringify";import{rehypeWrapCjk as i}from"rehype-wrap-cjk";import{unified as a}from"unified";const o=new Map;function s(e){return a().use(t,{fragment:!0}).use(i,e).use(n).use(r).freeze()}function c(){return a().use(t,{fragment:!0}).use(n).use(r).freeze()}function l(t){let n=t?e(t):``,r=o.get(n);return r||(r=t?s(t):c(),o.set(n,r)),r}const u={attribute:`lang`,value:`zh`},d={attribute:`lang`,value:`ja`},f={attribute:`lang`,value:`ko`};function p(e){return l(u).processSync(e).toString()}function m(e){return l(d).processSync(e).toString()}function h(e){return l(f).processSync(e).toString()}function g({input:e,wrapCjkOptions:t}){return l(t).processSync(e).toString()}export{p as wrapChinese,g as wrapCjk,m as wrapJapanese,h as wrapKorean};
|
package/dist/html.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./dist-
|
|
1
|
+
import{t as e}from"./dist-Dfh4058I.mjs";import t from"rehype-parse";import n from"rehype-sanitize";import r from"rehype-stringify";import{unified as i}from"unified";const a=new Map;function o(e){return i().use(t,{fragment:!0}).use(n,e).use(r).freeze()}function s(t){let n=t?e(t):``,r=a.get(n);return r||(r=o(t),a.set(n,r)),r}function c(e,t){let n=s(t);return String(n.processSync(e))}function l(e,t){return c(e,{...t,tagNames:[]})}export{c as sanitizeHtml,l as stripTags};
|
package/dist/markdown.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./dist-
|
|
1
|
+
import{t as e}from"./dist-Dfh4058I.mjs";import t from"rehype-sanitize";import n from"rehype-stringify";import{rehypeWrapCjk as r}from"rehype-wrap-cjk";import{unified as i}from"unified";import a from"remark-parse";import o from"remark-rehype";import s from"remark-smartypants";const c=new Map;function l(e){return i().use(a).use(s).use(o).use(r,e).use(t).use(n).freeze()}function u(){return i().use(a).use(s).use(o).use(t).use(n).freeze()}function d(t){let n=t?e(t):``,r=c.get(n);return r||(r=t?l(t):u(),c.set(n,r)),r}function f({input:e,wrapCjkOptions:t}){return d(t).processSync(e).toString().trim()}export{f as transformMarkdown};
|
package/dist/mdx.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./dist-
|
|
1
|
+
import{t as e}from"./dist-Dfh4058I.mjs";import t from"rehype-sanitize";import n from"rehype-stringify";import{unified as r}from"unified";import i from"remark-parse";import a from"remark-rehype";import o from"remark-mdx";const s=new Map,c={tagNames:[]};function l(e){return r().use(i).use(o).use(a).use(t,e).use(n).freeze()}function u(t){let n=t??c,r=e(n),i=s.get(r);return i||(i=l(n),s.set(r,i)),i}function d(e,t){return String(u(t).processSync(e)).replaceAll(/\s+/g,` `).trim()}export{d as sanitizeMdx};
|
package/dist/text.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./dist-
|
|
1
|
+
import{t as e}from"./dist-Dfh4058I.mjs";import{retext as t}from"retext";import n from"retext-smartypants";const r=new Map;function i(e){return t().use(n,e).freeze()}function a(t){let n=t?e(t):``,a=r.get(n);return a||(a=i(t),r.set(n,a)),a}function o(e,t){return String(a(t).processSync(e)).trim()}export{o as stylizeText};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xsynaptic/unified-tools",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "A common set of tools for transforming and manipulating markup and text",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"rehype-parse": "^9.0.1",
|
|
47
47
|
"rehype-sanitize": "^6.0.0",
|
|
48
48
|
"rehype-stringify": "^10.0.1",
|
|
49
|
-
"rehype-wrap-cjk": "^1.1
|
|
49
|
+
"rehype-wrap-cjk": "^2.1.1",
|
|
50
50
|
"remark-mdx": "^3.1.1",
|
|
51
51
|
"remark-parse": "^11.0.0",
|
|
52
52
|
"remark-rehype": "^11.1.2",
|
|
@@ -59,15 +59,15 @@
|
|
|
59
59
|
"@eslint/js": "^9.39.4",
|
|
60
60
|
"@types/jest": "^30.0.0",
|
|
61
61
|
"eslint": "^9.39.4",
|
|
62
|
-
"eslint-plugin-perfectionist": "^5.
|
|
62
|
+
"eslint-plugin-perfectionist": "^5.9.0",
|
|
63
63
|
"eslint-plugin-unicorn": "^64.0.0",
|
|
64
|
-
"globals": "^17.
|
|
64
|
+
"globals": "^17.6.0",
|
|
65
65
|
"ohash": "^2.0.11",
|
|
66
66
|
"prettier": "^3.8.3",
|
|
67
|
-
"tsdown": "^0.
|
|
68
|
-
"typescript": "^
|
|
69
|
-
"typescript-eslint": "^8.
|
|
70
|
-
"vitest": "^4.1.
|
|
67
|
+
"tsdown": "^0.21.10",
|
|
68
|
+
"typescript": "^6.0.3",
|
|
69
|
+
"typescript-eslint": "^8.59.2",
|
|
70
|
+
"vitest": "^4.1.5"
|
|
71
71
|
},
|
|
72
72
|
"packageManager": "pnpm@10.32.1+sha512.a706938f0e89ac1456b6563eab4edf1d1faf3368d1191fc5c59790e96dc918e4456ab2e67d613de1043d2e8c81f87303e6b40d4ffeca9df15ef1ad567348f2be"
|
|
73
73
|
}
|
package/src/html-cjk.ts
CHANGED
|
@@ -45,9 +45,18 @@ function getProcessor(wrapCjkOptions?: Partial<RehypeWrapCjkOptions>) {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
// Pre-defined options for common language codes
|
|
48
|
-
const zhOptions: Partial<RehypeWrapCjkOptions> = {
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
const zhOptions: Partial<RehypeWrapCjkOptions> = {
|
|
49
|
+
attribute: 'lang',
|
|
50
|
+
value: 'zh',
|
|
51
|
+
};
|
|
52
|
+
const jaOptions: Partial<RehypeWrapCjkOptions> = {
|
|
53
|
+
attribute: 'lang',
|
|
54
|
+
value: 'ja',
|
|
55
|
+
};
|
|
56
|
+
const koOptions: Partial<RehypeWrapCjkOptions> = {
|
|
57
|
+
attribute: 'lang',
|
|
58
|
+
value: 'ko',
|
|
59
|
+
};
|
|
51
60
|
|
|
52
61
|
export function wrapChinese(input: string): string {
|
|
53
62
|
return getProcessor(zhOptions).processSync(input).toString();
|
|
File without changes
|