@xsynaptic/unified-tools 3.0.2 → 4.0.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 CHANGED
@@ -1 +1 @@
1
- import{t as e}from"./dist-3QjHu5Qa.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={langCode:`zh`},d={langCode:`ja`},f={langCode:`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};
1
+ import{t as e}from"./dist-3QjHu5Qa.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xsynaptic/unified-tools",
3
- "version": "3.0.2",
3
+ "version": "4.0.0",
4
4
  "description": "A common set of tools for transforming and manipulating markup and text",
5
5
  "exports": {
6
6
  ".": {
@@ -21,6 +21,7 @@
21
21
  "build-tsc": "tsc --build",
22
22
  "check-types": "tsc --project tsconfig.json --noemit",
23
23
  "lint": "eslint",
24
+ "format": "prettier --write . && eslint --fix && tsc --noEmit --extendedDiagnostics",
24
25
  "test": "vitest",
25
26
  "prepublishOnly": "pnpm build"
26
27
  },
@@ -45,7 +46,7 @@
45
46
  "rehype-parse": "^9.0.1",
46
47
  "rehype-sanitize": "^6.0.0",
47
48
  "rehype-stringify": "^10.0.1",
48
- "rehype-wrap-cjk": "^1.0.10",
49
+ "rehype-wrap-cjk": "^2.0.0",
49
50
  "remark-mdx": "^3.1.1",
50
51
  "remark-parse": "^11.0.0",
51
52
  "remark-rehype": "^11.1.2",
@@ -58,15 +59,15 @@
58
59
  "@eslint/js": "^9.39.4",
59
60
  "@types/jest": "^30.0.0",
60
61
  "eslint": "^9.39.4",
61
- "eslint-plugin-perfectionist": "^5.6.0",
62
- "eslint-plugin-unicorn": "^63.0.0",
63
- "globals": "^17.4.0",
62
+ "eslint-plugin-perfectionist": "^5.8.0",
63
+ "eslint-plugin-unicorn": "^64.0.0",
64
+ "globals": "^17.5.0",
64
65
  "ohash": "^2.0.11",
65
- "prettier": "^3.8.1",
66
+ "prettier": "^3.8.3",
66
67
  "tsdown": "^0.19.0",
67
68
  "typescript": "^5.9.3",
68
- "typescript-eslint": "^8.57.0",
69
- "vitest": "^4.1.0"
69
+ "typescript-eslint": "^8.58.2",
70
+ "vitest": "^4.1.4"
70
71
  },
71
72
  "packageManager": "pnpm@10.32.1+sha512.a706938f0e89ac1456b6563eab4edf1d1faf3368d1191fc5c59790e96dc918e4456ab2e67d613de1043d2e8c81f87303e6b40d4ffeca9df15ef1ad567348f2be"
72
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> = { langCode: 'zh' };
49
- const jaOptions: Partial<RehypeWrapCjkOptions> = { langCode: 'ja' };
50
- const koOptions: Partial<RehypeWrapCjkOptions> = { langCode: 'ko' };
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();