@xsynaptic/unified-tools 0.0.8 → 2.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.
Files changed (61) hide show
  1. package/dist/html-cjk.d.mts +15 -0
  2. package/dist/html-cjk.mjs +1 -0
  3. package/dist/html.d.mts +11 -0
  4. package/dist/html.mjs +1 -0
  5. package/dist/index.d.mts +7 -0
  6. package/dist/index.mjs +1 -0
  7. package/dist/markdown.d.mts +12 -0
  8. package/dist/markdown.mjs +1 -0
  9. package/dist/mdx.d.mts +6 -0
  10. package/dist/mdx.mjs +1 -0
  11. package/dist/text.d.mts +6 -0
  12. package/dist/text.mjs +1 -0
  13. package/package.json +19 -24
  14. package/src/__tests__/sanitize-html.test.ts +16 -16
  15. package/src/html-cjk.ts +53 -0
  16. package/src/html.ts +33 -0
  17. package/src/index.ts +5 -4
  18. package/src/markdown.ts +28 -0
  19. package/src/mdx.ts +22 -0
  20. package/src/{stylize-text.ts → text.ts} +5 -5
  21. package/dist/chunk-22KUJHGV.js +0 -2
  22. package/dist/chunk-22KUJHGV.js.map +0 -1
  23. package/dist/chunk-FAO346AP.js +0 -2
  24. package/dist/chunk-FAO346AP.js.map +0 -1
  25. package/dist/chunk-IWTHDXJM.js +0 -2
  26. package/dist/chunk-IWTHDXJM.js.map +0 -1
  27. package/dist/chunk-UEE5G5GV.js +0 -2
  28. package/dist/chunk-UEE5G5GV.js.map +0 -1
  29. package/dist/index.cjs +0 -2
  30. package/dist/index.cjs.map +0 -1
  31. package/dist/index.d.cts +0 -6
  32. package/dist/index.d.ts +0 -6
  33. package/dist/index.js +0 -2
  34. package/dist/index.js.map +0 -1
  35. package/dist/sanitize-html.cjs +0 -2
  36. package/dist/sanitize-html.cjs.map +0 -1
  37. package/dist/sanitize-html.d.cts +0 -6
  38. package/dist/sanitize-html.d.ts +0 -6
  39. package/dist/sanitize-html.js +0 -2
  40. package/dist/sanitize-html.js.map +0 -1
  41. package/dist/stylize-text.cjs +0 -2
  42. package/dist/stylize-text.cjs.map +0 -1
  43. package/dist/stylize-text.d.cts +0 -5
  44. package/dist/stylize-text.d.ts +0 -5
  45. package/dist/stylize-text.js +0 -2
  46. package/dist/stylize-text.js.map +0 -1
  47. package/dist/transform-markdown.cjs +0 -2
  48. package/dist/transform-markdown.cjs.map +0 -1
  49. package/dist/transform-markdown.d.cts +0 -3
  50. package/dist/transform-markdown.d.ts +0 -3
  51. package/dist/transform-markdown.js +0 -2
  52. package/dist/transform-markdown.js.map +0 -1
  53. package/dist/wrap-cjk.cjs +0 -2
  54. package/dist/wrap-cjk.cjs.map +0 -1
  55. package/dist/wrap-cjk.d.cts +0 -3
  56. package/dist/wrap-cjk.d.ts +0 -3
  57. package/dist/wrap-cjk.js +0 -2
  58. package/dist/wrap-cjk.js.map +0 -1
  59. package/src/sanitize-html.ts +0 -20
  60. package/src/transform-markdown.ts +0 -20
  61. package/src/wrap-cjk.ts +0 -16
@@ -0,0 +1,15 @@
1
+ import { RehypeWrapCjkOptions } from "rehype-wrap-cjk";
2
+
3
+ //#region src/html-cjk.d.ts
4
+ declare function wrapChinese(input: string): string;
5
+ declare function wrapJapanese(input: string): string;
6
+ declare function wrapKorean(input: string): string;
7
+ declare function wrapCjk({
8
+ input,
9
+ wrapCjkOptions
10
+ }: {
11
+ input: string;
12
+ wrapCjkOptions?: Partial<RehypeWrapCjkOptions>;
13
+ }): string;
14
+ //#endregion
15
+ export { wrapChinese, wrapCjk, wrapJapanese, wrapKorean };
@@ -0,0 +1 @@
1
+ import e from"rehype-parse";import t from"rehype-sanitize";import n from"rehype-stringify";import{rehypeWrapCjk as r}from"rehype-wrap-cjk";import{unified as i}from"unified";function a(a){return i().use(e,{fragment:!0}).use(r,{langCode:`zh`}).use(t).use(n).processSync(a).toString()}function o(a){return i().use(e,{fragment:!0}).use(r,{langCode:`ja`}).use(t).use(n).processSync(a).toString()}function s(a){return i().use(e,{fragment:!0}).use(r,{langCode:`ko`}).use(t).use(n).processSync(a).toString()}function c({input:a,wrapCjkOptions:o}){let s=i().use(e,{fragment:!0});return o&&s.use(r,o),s.use(t).use(n),s.processSync(a).toString()}export{a as wrapChinese,c as wrapCjk,o as wrapJapanese,s as wrapKorean};
@@ -0,0 +1,11 @@
1
+ import { Options } from "rehype-sanitize";
2
+
3
+ //#region src/html.d.ts
4
+ declare function sanitizeHtml(input: string, options?: Options): string;
5
+ declare const stripTags: (input: string, options?: Options) => string;
6
+ /**
7
+ * Strips GFM-style footnotes from HTML content using a simple regex approach
8
+ */
9
+ declare function stripFootnotes(input: string): string;
10
+ //#endregion
11
+ export { sanitizeHtml, stripFootnotes, stripTags };
package/dist/html.mjs ADDED
@@ -0,0 +1 @@
1
+ import e from"rehype-parse";import t from"rehype-sanitize";import n from"rehype-stringify";import{unified as r}from"unified";function i(i,a){let o=r().use(e,{fragment:!0}).use(t,a).use(n).processSync(i);return String(o)}const a=(e,t)=>i(e,{...t,tagNames:[]});function o(e){let t=e.replaceAll(/<sup><a[^>]*data-footnote-ref[^>]*>.*?<\/a><\/sup>/gi,``);return t=t.replaceAll(/<section[^>]*data-footnotes[^>]*>.*?<\/section>/gis,``),t}export{i as sanitizeHtml,o as stripFootnotes,a as stripTags};
@@ -0,0 +1,7 @@
1
+ import { wrapChinese, wrapCjk, wrapJapanese, wrapKorean } from "./html-cjk.mjs";
2
+ import { sanitizeHtml, stripFootnotes, stripTags } from "./html.mjs";
3
+ import { transformMarkdown } from "./markdown.mjs";
4
+ import { sanitizeMdx } from "./mdx.mjs";
5
+ import { stylizeText } from "./text.mjs";
6
+ import { defaultSchema } from "rehype-sanitize";
7
+ export { defaultSchema, sanitizeHtml, sanitizeMdx, stripFootnotes, stripTags, stylizeText, transformMarkdown, wrapChinese, wrapCjk, wrapJapanese, wrapKorean };
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ import{wrapChinese as e,wrapCjk as t,wrapJapanese as n,wrapKorean as r}from"./html-cjk.mjs";import{sanitizeHtml as i,stripFootnotes as a,stripTags as o}from"./html.mjs";import{transformMarkdown as s}from"./markdown.mjs";import{sanitizeMdx as c}from"./mdx.mjs";import{stylizeText as l}from"./text.mjs";import{defaultSchema as u}from"rehype-sanitize";export{u as defaultSchema,i as sanitizeHtml,c as sanitizeMdx,a as stripFootnotes,o as stripTags,l as stylizeText,s as transformMarkdown,e as wrapChinese,t as wrapCjk,n as wrapJapanese,r as wrapKorean};
@@ -0,0 +1,12 @@
1
+ import { RehypeWrapCjkOptions } from "rehype-wrap-cjk";
2
+
3
+ //#region src/markdown.d.ts
4
+ declare function transformMarkdown({
5
+ input,
6
+ wrapCjkOptions
7
+ }: {
8
+ input: string;
9
+ wrapCjkOptions?: Partial<RehypeWrapCjkOptions>;
10
+ }): string;
11
+ //#endregion
12
+ export { transformMarkdown };
@@ -0,0 +1 @@
1
+ import e from"rehype-sanitize";import t from"rehype-stringify";import{rehypeWrapCjk as n}from"rehype-wrap-cjk";import{unified as r}from"unified";import i from"remark-parse";import a from"remark-rehype";import o from"remark-smartypants";function s({input:s,wrapCjkOptions:c}){let l=r().use(i).use(o).use(a);return c&&l.use(n,c),l.use(e).use(t),l.processSync(s).toString().trim()}export{s as transformMarkdown};
package/dist/mdx.d.mts ADDED
@@ -0,0 +1,6 @@
1
+ import { Options } from "rehype-sanitize";
2
+
3
+ //#region src/mdx.d.ts
4
+ declare function sanitizeMdx(input: string, options?: Options): string;
5
+ //#endregion
6
+ export { sanitizeMdx };
package/dist/mdx.mjs ADDED
@@ -0,0 +1 @@
1
+ import e from"rehype-sanitize";import t from"rehype-stringify";import{unified as n}from"unified";import r from"remark-parse";import i from"remark-rehype";import a from"remark-mdx";function o(o,s){let c=n().use(r).use(a).use(i).use(e,s??{tagNames:[]}).use(t).processSync(o);return String(c).replaceAll(/\s+/g,` `).trim()}export{o as sanitizeMdx};
@@ -0,0 +1,6 @@
1
+ import { Options } from "retext-smartypants";
2
+
3
+ //#region src/text.d.ts
4
+ declare function stylizeText(input: string, options?: Options): string;
5
+ //#endregion
6
+ export { stylizeText };
package/dist/text.mjs ADDED
@@ -0,0 +1 @@
1
+ import{retext as e}from"retext";import t from"retext-smartypants";function n(n,r){let i=e().use(t,r).processSync(n);return String(i).trim()}export{n as stylizeText};
package/package.json CHANGED
@@ -1,21 +1,15 @@
1
1
  {
2
2
  "name": "@xsynaptic/unified-tools",
3
- "version": "0.0.8",
3
+ "version": "2.0.0",
4
4
  "description": "A common set of tools for transforming and manipulating markup and text",
5
5
  "exports": {
6
6
  ".": {
7
- "import": {
8
- "types": "./dist/index.d.ts",
9
- "default": "./dist/index.js"
10
- },
11
- "require": {
12
- "types": "./dist/index.d.cts",
13
- "default": "./dist/index.cjs"
14
- }
7
+ "types": "./dist/index.d.mts",
8
+ "import": "./dist/index.mjs"
15
9
  }
16
10
  },
17
- "main": "dist/index.js",
18
- "types": "dist/index.d.ts",
11
+ "main": "dist/index.mjs",
12
+ "types": "dist/index.d.mts",
19
13
  "sideEffects": false,
20
14
  "files": [
21
15
  "dist/**/*",
@@ -23,7 +17,7 @@
23
17
  ],
24
18
  "type": "module",
25
19
  "scripts": {
26
- "build": "tsup",
20
+ "build": "tsdown",
27
21
  "build-tsc": "tsc --build",
28
22
  "check-types": "tsc --project tsconfig.json --noemit",
29
23
  "lint": "eslint",
@@ -51,7 +45,8 @@
51
45
  "rehype-parse": "^9.0.1",
52
46
  "rehype-sanitize": "^6.0.0",
53
47
  "rehype-stringify": "^10.0.1",
54
- "rehype-wrap-cjk": "^0.3.0",
48
+ "rehype-wrap-cjk": "^1.0.5",
49
+ "remark-mdx": "^3.1.1",
55
50
  "remark-parse": "^11.0.0",
56
51
  "remark-rehype": "^11.1.2",
57
52
  "remark-smartypants": "^3.0.2",
@@ -60,17 +55,17 @@
60
55
  "unified": "^11.0.5"
61
56
  },
62
57
  "devDependencies": {
63
- "@eslint/js": "^9.32.0",
58
+ "@eslint/js": "^9.39.2",
64
59
  "@types/jest": "^30.0.0",
65
- "eslint": "^9.32.0",
66
- "eslint-plugin-simple-import-sort": "^12.1.1",
67
- "eslint-plugin-unicorn": "^60.0.0",
68
- "globals": "^16.3.0",
69
- "prettier": "^3.6.2",
70
- "tsup": "^8.5.0",
71
- "typescript": "^5.8.3",
72
- "typescript-eslint": "^8.38.0",
73
- "vitest": "^3.2.4"
60
+ "eslint": "^9.39.2",
61
+ "eslint-plugin-perfectionist": "^5.1.0",
62
+ "eslint-plugin-unicorn": "^62.0.0",
63
+ "globals": "^16.5.0",
64
+ "prettier": "^3.7.4",
65
+ "tsdown": "^0.18.3",
66
+ "typescript": "^5.9.3",
67
+ "typescript-eslint": "^8.51.0",
68
+ "vitest": "^4.0.16"
74
69
  },
75
- "packageManager": "pnpm@10.13.1+sha512.37ebf1a5c7a30d5fabe0c5df44ee8da4c965ca0c5af3dbab28c3a1681b70a256218d05c81c9c0dcf767ef6b8551eb5b960042b9ed4300c59242336377e01cfad"
70
+ "packageManager": "pnpm@10.26.2+sha512.0e308ff2005fc7410366f154f625f6631ab2b16b1d2e70238444dd6ae9d630a8482d92a451144debc492416896ed16f7b114a86ec68b8404b2443869e68ffda6"
76
71
  }
@@ -1,22 +1,22 @@
1
- import { stripTags } from '../sanitize-html.js';
1
+ import { stripTags } from '../html.js';
2
2
 
3
3
  const sampleText = [
4
- [`No change to plain text`, `No change to plain text`],
5
- [`Emphasis <em>should</em> be removed`, `Emphasis should be removed`],
6
- [
7
- `This <a href="https://example.com">link</a> should be stripped`,
8
- `This link should be stripped`,
9
- ],
10
- [
11
- `The following MDX component should not appear at all: <Img src="./test1.jpg" />`,
12
- `The following MDX component should not appear at all: `,
13
- ],
4
+ [`No change to plain text`, `No change to plain text`],
5
+ [`Emphasis <em>should</em> be removed`, `Emphasis should be removed`],
6
+ [
7
+ `This <a href="https://example.com">link</a> should be stripped`,
8
+ `This link should be stripped`,
9
+ ],
10
+ [
11
+ `The following MDX component should not appear at all: <Img src="./test1.jpg" />`,
12
+ `The following MDX component should not appear at all: `,
13
+ ],
14
14
  ] as const;
15
15
 
16
16
  describe('html tags should be stripped', () => {
17
- for (const [input, output] of sampleText) {
18
- test(input, () => {
19
- expect(stripTags(input)).toEqual(output);
20
- });
21
- }
17
+ for (const [input, output] of sampleText) {
18
+ test(input, () => {
19
+ expect(stripTags(input)).toEqual(output);
20
+ });
21
+ }
22
22
  });
@@ -0,0 +1,53 @@
1
+ import type { RehypeWrapCjkOptions } from 'rehype-wrap-cjk';
2
+
3
+ import rehypeParse from 'rehype-parse';
4
+ import rehypeSanitize from 'rehype-sanitize';
5
+ import rehypeStringify from 'rehype-stringify';
6
+ import { rehypeWrapCjk } from 'rehype-wrap-cjk';
7
+ import { unified } from 'unified';
8
+
9
+ export function wrapChinese(input: string): string {
10
+ const processor = unified()
11
+ .use(rehypeParse, { fragment: true })
12
+ .use(rehypeWrapCjk, { langCode: 'zh' })
13
+ .use(rehypeSanitize)
14
+ .use(rehypeStringify);
15
+
16
+ return processor.processSync(input).toString();
17
+ }
18
+
19
+ export function wrapJapanese(input: string): string {
20
+ const processor = unified()
21
+ .use(rehypeParse, { fragment: true })
22
+ .use(rehypeWrapCjk, { langCode: 'ja' })
23
+ .use(rehypeSanitize)
24
+ .use(rehypeStringify);
25
+
26
+ return processor.processSync(input).toString();
27
+ }
28
+
29
+ export function wrapKorean(input: string): string {
30
+ const processor = unified()
31
+ .use(rehypeParse, { fragment: true })
32
+ .use(rehypeWrapCjk, { langCode: 'ko' })
33
+ .use(rehypeSanitize)
34
+ .use(rehypeStringify);
35
+
36
+ return processor.processSync(input).toString();
37
+ }
38
+
39
+ export function wrapCjk({
40
+ input,
41
+ wrapCjkOptions,
42
+ }: {
43
+ input: string;
44
+ wrapCjkOptions?: Partial<RehypeWrapCjkOptions>;
45
+ }): string {
46
+ const processor = unified().use(rehypeParse, { fragment: true });
47
+
48
+ if (wrapCjkOptions) processor.use(rehypeWrapCjk, wrapCjkOptions);
49
+
50
+ processor.use(rehypeSanitize).use(rehypeStringify);
51
+
52
+ return processor.processSync(input).toString();
53
+ }
package/src/html.ts ADDED
@@ -0,0 +1,33 @@
1
+ import type { Options as RehypeSanitizeOptions } from 'rehype-sanitize';
2
+
3
+ import rehypeParse from 'rehype-parse';
4
+ import rehypeSanitize from 'rehype-sanitize';
5
+ import rehypeStringify from 'rehype-stringify';
6
+ import { unified } from 'unified';
7
+
8
+ export function sanitizeHtml(input: string, options?: RehypeSanitizeOptions): string {
9
+ const processor = unified()
10
+ .use(rehypeParse, { fragment: true })
11
+ .use(rehypeSanitize, options)
12
+ .use(rehypeStringify)
13
+ .processSync(input);
14
+
15
+ return String(processor);
16
+ }
17
+
18
+ // Handy shortcut for when you just want to strip tags from text
19
+ export const stripTags = (input: string, options?: RehypeSanitizeOptions): string =>
20
+ sanitizeHtml(input, { ...options, tagNames: [] });
21
+
22
+ /**
23
+ * Strips GFM-style footnotes from HTML content using a simple regex approach
24
+ */
25
+ export function stripFootnotes(input: string): string {
26
+ // Remove footnote references (`sup` elements with footnote links)
27
+ let result = input.replaceAll(/<sup><a[^>]*data-footnote-ref[^>]*>.*?<\/a><\/sup>/gi, '');
28
+
29
+ // Remove the entire footnotes section
30
+ result = result.replaceAll(/<section[^>]*data-footnotes[^>]*>.*?<\/section>/gis, '');
31
+
32
+ return result;
33
+ }
package/src/index.ts CHANGED
@@ -1,5 +1,6 @@
1
- export { sanitizeHtml, stripTags } from './sanitize-html.js';
2
- export { stylizeText } from './stylize-text.js';
3
- export { transformMarkdown } from './transform-markdown.js';
4
- export { wrapCjk } from './wrap-cjk.js';
1
+ export { wrapChinese, wrapCjk, wrapJapanese, wrapKorean } from './html-cjk.js';
2
+ export { sanitizeHtml, stripFootnotes, stripTags } from './html.js';
3
+ export { transformMarkdown } from './markdown.js';
4
+ export { sanitizeMdx } from './mdx.js';
5
+ export { stylizeText } from './text.js';
5
6
  export { defaultSchema } from 'rehype-sanitize';
@@ -0,0 +1,28 @@
1
+ import type { RehypeWrapCjkOptions } from 'rehype-wrap-cjk';
2
+
3
+ import rehypeSanitize from 'rehype-sanitize';
4
+ import rehypeStringify from 'rehype-stringify';
5
+ import { rehypeWrapCjk } from 'rehype-wrap-cjk';
6
+ import remarkParse from 'remark-parse';
7
+ import remarkRehype from 'remark-rehype';
8
+ import remarkSmartyPants from 'remark-smartypants';
9
+ import { unified } from 'unified';
10
+
11
+ export function transformMarkdown({
12
+ input,
13
+ wrapCjkOptions,
14
+ }: {
15
+ input: string;
16
+ wrapCjkOptions?: Partial<RehypeWrapCjkOptions>;
17
+ }): string {
18
+ const processor = unified()
19
+ .use(remarkParse)
20
+ .use(remarkSmartyPants)
21
+ .use(remarkRehype);
22
+
23
+ if (wrapCjkOptions) processor.use(rehypeWrapCjk, wrapCjkOptions);
24
+
25
+ processor.use(rehypeSanitize).use(rehypeStringify);
26
+
27
+ return processor.processSync(input).toString().trim();
28
+ }
package/src/mdx.ts ADDED
@@ -0,0 +1,22 @@
1
+ import type { Options as RehypeSanitizeOptions } from 'rehype-sanitize';
2
+
3
+ import rehypeSanitize from 'rehype-sanitize';
4
+ import rehypeStringify from 'rehype-stringify';
5
+ import remarkMdx from 'remark-mdx';
6
+ import remarkParse from 'remark-parse';
7
+ import remarkRehype from 'remark-rehype';
8
+ import { unified } from 'unified';
9
+
10
+ export function sanitizeMdx(input: string, options?: RehypeSanitizeOptions): string {
11
+ const processor = unified()
12
+ .use(remarkParse)
13
+ .use(remarkMdx)
14
+ .use(remarkRehype)
15
+ .use(rehypeSanitize, options ?? { tagNames: [] }) // Strip all tags
16
+ .use(rehypeStringify)
17
+ .processSync(input);
18
+
19
+ return String(processor)
20
+ .replaceAll(/\s+/g, ' ') // Normalize whitespace
21
+ .trim();
22
+ }
@@ -1,10 +1,10 @@
1
+ import type { Options as RetextSmartypantsOptions } from 'retext-smartypants';
2
+
1
3
  import { retext } from 'retext';
2
4
  import retextSmartypants from 'retext-smartypants';
3
5
 
4
- import type { Options as RetextSmartypantsOptions } from 'retext-smartypants';
5
-
6
- export function stylizeText(input: string, options?: RetextSmartypantsOptions) {
7
- const output = retext().use(retextSmartypants, options).processSync(input);
6
+ export function stylizeText(input: string, options?: RetextSmartypantsOptions): string {
7
+ const processor = retext().use(retextSmartypants, options).processSync(input);
8
8
 
9
- return String(output);
9
+ return String(processor).trim();
10
10
  }
@@ -1,2 +0,0 @@
1
- import {retext}from'retext';import n from'retext-smartypants';function i(t,r){let e=retext().use(n,r).processSync(t);return String(e)}export{i as a};//# sourceMappingURL=chunk-22KUJHGV.js.map
2
- //# sourceMappingURL=chunk-22KUJHGV.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/stylize-text.ts"],"names":["stylizeText","input","options","output","retext","retextSmartypants"],"mappings":"8DAKO,SAASA,CAAAA,CAAYC,CAAeC,CAAAA,CAAAA,CAAoC,CAC7E,IAAMC,EAASC,MAAO,EAAA,CAAE,GAAIC,CAAAA,CAAAA,CAAmBH,CAAO,CAAA,CAAE,WAAYD,CAAAA,CAAK,CAEzE,CAAA,OAAO,MAAOE,CAAAA,CAAM,CACtB","file":"chunk-22KUJHGV.js","sourcesContent":["import { retext } from 'retext';\nimport retextSmartypants from 'retext-smartypants';\n\nimport type { Options as RetextSmartypantsOptions } from 'retext-smartypants';\n\nexport function stylizeText(input: string, options?: RetextSmartypantsOptions) {\n const output = retext().use(retextSmartypants, options).processSync(input);\n\n return String(output);\n}\n"]}
@@ -1,2 +0,0 @@
1
- import r from'rehype-parse';import n from'rehype-sanitize';import p from'rehype-stringify';import {unified}from'unified';function s(e,t){let i=unified().use(r,{fragment:true}).use(n,t).use(p).processSync(e);return String(i)}var u=(e,t)=>s(e,{...t,tagNames:[]});export{s as a,u as b};//# sourceMappingURL=chunk-FAO346AP.js.map
2
- //# sourceMappingURL=chunk-FAO346AP.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/sanitize-html.ts"],"names":["sanitizeHtml","input","options","output","unified","rehypeParse","rehypeSanitize","rehypeStringify","stripTags"],"mappings":"yHAOO,SAASA,EAAaC,CAAeC,CAAAA,CAAAA,CAAiC,CAC3E,IAAMC,CAASC,CAAAA,OAAAA,EACZ,CAAA,GAAA,CAAIC,CAAa,CAAA,CAAE,QAAU,CAAA,IAAK,CAAC,CAAA,CACnC,IAAIC,CAAgBJ,CAAAA,CAAO,CAC3B,CAAA,GAAA,CAAIK,CAAe,CAAA,CACnB,WAAYN,CAAAA,CAAK,CAEpB,CAAA,OAAO,MAAOE,CAAAA,CAAM,CACtB,KAGaK,CAAY,CAAA,CAACP,CAAeC,CAAAA,CAAAA,GACvCF,CAAaC,CAAAA,CAAAA,CAAO,CAAE,GAAGC,CAAS,CAAA,QAAA,CAAU,EAAG,CAAC","file":"chunk-FAO346AP.js","sourcesContent":["import rehypeParse from 'rehype-parse';\nimport rehypeSanitize from 'rehype-sanitize';\nimport rehypeStringify from 'rehype-stringify';\nimport { unified } from 'unified';\n\nimport type { Options as RehypeSanitizeOptions } from 'rehype-sanitize';\n\nexport function sanitizeHtml(input: string, options?: RehypeSanitizeOptions) {\n const output = unified()\n .use(rehypeParse, { fragment: true })\n .use(rehypeSanitize, options)\n .use(rehypeStringify)\n .processSync(input);\n\n return String(output);\n}\n\n// Handy shortcut for when you just want to strip tags from text\nexport const stripTags = (input: string, options?: RehypeSanitizeOptions) =>\n sanitizeHtml(input, { ...options, tagNames: [] });\n"]}
@@ -1,2 +0,0 @@
1
- import t from'rehype-parse';import o from'rehype-sanitize';import i from'rehype-stringify';import p from'rehype-wrap-cjk';import {unified}from'unified';function a(r){let e=unified().use(t,{fragment:true}).use(p).use(o).use(i).processSync(r);return String(e)}export{a};//# sourceMappingURL=chunk-IWTHDXJM.js.map
2
- //# sourceMappingURL=chunk-IWTHDXJM.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/wrap-cjk.ts"],"names":["wrapCjk","input","output","unified","rehypeParse","rehypeWrapCjk","rehypeSanitize","rehypeStringify"],"mappings":"wJAMO,SAASA,EAAQC,CAAe,CAAA,CACrC,IAAMC,CAASC,CAAAA,OAAAA,GACZ,GAAIC,CAAAA,CAAAA,CAAa,CAAE,QAAU,CAAA,IAAK,CAAC,CACnC,CAAA,GAAA,CAAIC,CAAa,CACjB,CAAA,GAAA,CAAIC,CAAc,CAClB,CAAA,GAAA,CAAIC,CAAe,CACnB,CAAA,WAAA,CAAYN,CAAK,CAEpB,CAAA,OAAO,MAAOC,CAAAA,CAAM,CACtB","file":"chunk-IWTHDXJM.js","sourcesContent":["import rehypeParse from 'rehype-parse';\nimport rehypeSanitize from 'rehype-sanitize';\nimport rehypeStringify from 'rehype-stringify';\nimport rehypeWrapCjk from 'rehype-wrap-cjk';\nimport { unified } from 'unified';\n\nexport function wrapCjk(input: string) {\n const output = unified()\n .use(rehypeParse, { fragment: true })\n .use(rehypeWrapCjk)\n .use(rehypeSanitize)\n .use(rehypeStringify)\n .processSync(input);\n\n return String(output);\n}\n"]}
@@ -1,2 +0,0 @@
1
- import o from'rehype-sanitize';import t from'rehype-stringify';import m from'rehype-wrap-cjk';import i from'remark-parse';import p from'remark-rehype';import n from'remark-smartypants';import {unified}from'unified';function h(r){let e=unified().use(i).use(n).use(p).use(m).use(o).use(t).processSync(r);return String(e)}export{h as a};//# sourceMappingURL=chunk-UEE5G5GV.js.map
2
- //# sourceMappingURL=chunk-UEE5G5GV.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/transform-markdown.ts"],"names":["transformMarkdown","input","output","unified","remarkParse","remarkSmartyPants","remarkRehype","rehypeWrapCjk","rehypeSanitize","rehypeStringify"],"mappings":"uNAQO,SAASA,CAAkBC,CAAAA,CAAAA,CAAe,CAC/C,IAAMC,EAASC,OAAQ,EAAA,CACpB,GAAIC,CAAAA,CAAW,CACf,CAAA,GAAA,CAAIC,CAAiB,CACrB,CAAA,GAAA,CAAIC,CAAY,CAAA,CAChB,GAAIC,CAAAA,CAAa,EACjB,GAAIC,CAAAA,CAAc,CAClB,CAAA,GAAA,CAAIC,CAAe,CAAA,CACnB,WAAYR,CAAAA,CAAK,CAEpB,CAAA,OAAO,MAAOC,CAAAA,CAAM,CACtB","file":"chunk-UEE5G5GV.js","sourcesContent":["import rehypeSanitize from 'rehype-sanitize';\nimport rehypeStringify from 'rehype-stringify';\nimport rehypeWrapCjk from 'rehype-wrap-cjk';\nimport remarkParse from 'remark-parse';\nimport remarkRehype from 'remark-rehype';\nimport remarkSmartyPants from 'remark-smartypants';\nimport { unified } from 'unified';\n\nexport function transformMarkdown(input: string) {\n const output = unified()\n .use(remarkParse)\n .use(remarkSmartyPants)\n .use(remarkRehype)\n .use(rehypeWrapCjk)\n .use(rehypeSanitize)\n .use(rehypeStringify)\n .processSync(input);\n\n return String(output);\n}\n"]}
package/dist/index.cjs DELETED
@@ -1,2 +0,0 @@
1
- 'use strict';var i=require('rehype-parse'),p=require('rehype-sanitize'),n=require('rehype-stringify'),unified=require('unified'),retext=require('retext'),f=require('retext-smartypants'),c=require('rehype-wrap-cjk'),g=require('remark-parse'),x=require('remark-rehype'),h=require('remark-smartypants');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var i__default=/*#__PURE__*/_interopDefault(i);var p__default=/*#__PURE__*/_interopDefault(p);var n__default=/*#__PURE__*/_interopDefault(n);var f__default=/*#__PURE__*/_interopDefault(f);var c__default=/*#__PURE__*/_interopDefault(c);var g__default=/*#__PURE__*/_interopDefault(g);var x__default=/*#__PURE__*/_interopDefault(x);var h__default=/*#__PURE__*/_interopDefault(h);function o(r,t){let e=unified.unified().use(i__default.default,{fragment:true}).use(p__default.default,t).use(n__default.default).processSync(r);return String(e)}var m=(r,t)=>o(r,{...t,tagNames:[]});function u(r,t){let e=retext.retext().use(f__default.default,t).processSync(r);return String(e)}function k(r){let t=unified.unified().use(g__default.default).use(h__default.default).use(x__default.default).use(c__default.default).use(p__default.default).use(n__default.default).processSync(r);return String(t)}function w(r){let t=unified.unified().use(i__default.default,{fragment:true}).use(c__default.default).use(p__default.default).use(n__default.default).processSync(r);return String(t)}Object.defineProperty(exports,"defaultSchema",{enumerable:true,get:function(){return p.defaultSchema}});exports.sanitizeHtml=o;exports.stripTags=m;exports.stylizeText=u;exports.transformMarkdown=k;exports.wrapCjk=w;//# sourceMappingURL=index.cjs.map
2
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/sanitize-html.ts","../src/stylize-text.ts","../src/transform-markdown.ts","../src/wrap-cjk.ts"],"names":["sanitizeHtml","input","options","output","unified","rehypeParse","rehypeSanitize","rehypeStringify","stripTags","stylizeText","retext","retextSmartypants","transformMarkdown","remarkParse","remarkSmartyPants","remarkRehype","rehypeWrapCjk","wrapCjk"],"mappings":"quBAOO,SAASA,EAAaC,CAAeC,CAAAA,CAAAA,CAAiC,CAC3E,IAAMC,CAAAA,CAASC,iBACZ,CAAA,GAAA,CAAIC,mBAAa,CAAE,QAAA,CAAU,IAAK,CAAC,CAAA,CACnC,IAAIC,kBAAgBJ,CAAAA,CAAO,EAC3B,GAAIK,CAAAA,kBAAe,EACnB,WAAYN,CAAAA,CAAK,EAEpB,OAAO,MAAA,CAAOE,CAAM,CACtB,CAGaK,IAAAA,CAAAA,CAAY,CAACP,CAAAA,CAAeC,IACvCF,CAAaC,CAAAA,CAAAA,CAAO,CAAE,GAAGC,CAAAA,CAAS,SAAU,EAAG,CAAC,ECd3C,SAASO,CAAYR,CAAAA,CAAAA,CAAeC,EAAoC,CAC7E,IAAMC,EAASO,aAAO,EAAA,CAAE,IAAIC,kBAAmBT,CAAAA,CAAO,EAAE,WAAYD,CAAAA,CAAK,EAEzE,OAAO,MAAA,CAAOE,CAAM,CACtB,CCDO,SAASS,CAAkBX,CAAAA,CAAAA,CAAe,CAC/C,IAAME,CAAAA,CAASC,iBACZ,CAAA,GAAA,CAAIS,kBAAW,CACf,CAAA,GAAA,CAAIC,kBAAiB,CACrB,CAAA,GAAA,CAAIC,kBAAY,CAChB,CAAA,GAAA,CAAIC,kBAAa,CACjB,CAAA,GAAA,CAAIV,kBAAc,CAClB,CAAA,GAAA,CAAIC,kBAAe,CACnB,CAAA,WAAA,CAAYN,CAAK,CAEpB,CAAA,OAAO,OAAOE,CAAM,CACtB,CCbO,SAASc,CAAAA,CAAQhB,EAAe,CACrC,IAAME,EAASC,eAAQ,EAAA,CACpB,IAAIC,kBAAa,CAAA,CAAE,SAAU,IAAK,CAAC,EACnC,GAAIW,CAAAA,kBAAa,EACjB,GAAIV,CAAAA,kBAAc,EAClB,GAAIC,CAAAA,kBAAe,EACnB,WAAYN,CAAAA,CAAK,EAEpB,OAAO,MAAA,CAAOE,CAAM,CACtB","file":"index.cjs","sourcesContent":["import rehypeParse from 'rehype-parse';\nimport rehypeSanitize from 'rehype-sanitize';\nimport rehypeStringify from 'rehype-stringify';\nimport { unified } from 'unified';\n\nimport type { Options as RehypeSanitizeOptions } from 'rehype-sanitize';\n\nexport function sanitizeHtml(input: string, options?: RehypeSanitizeOptions) {\n const output = unified()\n .use(rehypeParse, { fragment: true })\n .use(rehypeSanitize, options)\n .use(rehypeStringify)\n .processSync(input);\n\n return String(output);\n}\n\n// Handy shortcut for when you just want to strip tags from text\nexport const stripTags = (input: string, options?: RehypeSanitizeOptions) =>\n sanitizeHtml(input, { ...options, tagNames: [] });\n","import { retext } from 'retext';\nimport retextSmartypants from 'retext-smartypants';\n\nimport type { Options as RetextSmartypantsOptions } from 'retext-smartypants';\n\nexport function stylizeText(input: string, options?: RetextSmartypantsOptions) {\n const output = retext().use(retextSmartypants, options).processSync(input);\n\n return String(output);\n}\n","import rehypeSanitize from 'rehype-sanitize';\nimport rehypeStringify from 'rehype-stringify';\nimport rehypeWrapCjk from 'rehype-wrap-cjk';\nimport remarkParse from 'remark-parse';\nimport remarkRehype from 'remark-rehype';\nimport remarkSmartyPants from 'remark-smartypants';\nimport { unified } from 'unified';\n\nexport function transformMarkdown(input: string) {\n const output = unified()\n .use(remarkParse)\n .use(remarkSmartyPants)\n .use(remarkRehype)\n .use(rehypeWrapCjk)\n .use(rehypeSanitize)\n .use(rehypeStringify)\n .processSync(input);\n\n return String(output);\n}\n","import rehypeParse from 'rehype-parse';\nimport rehypeSanitize from 'rehype-sanitize';\nimport rehypeStringify from 'rehype-stringify';\nimport rehypeWrapCjk from 'rehype-wrap-cjk';\nimport { unified } from 'unified';\n\nexport function wrapCjk(input: string) {\n const output = unified()\n .use(rehypeParse, { fragment: true })\n .use(rehypeWrapCjk)\n .use(rehypeSanitize)\n .use(rehypeStringify)\n .processSync(input);\n\n return String(output);\n}\n"]}
package/dist/index.d.cts DELETED
@@ -1,6 +0,0 @@
1
- export { sanitizeHtml, stripTags } from './sanitize-html.cjs';
2
- export { stylizeText } from './stylize-text.cjs';
3
- export { transformMarkdown } from './transform-markdown.cjs';
4
- export { wrapCjk } from './wrap-cjk.cjs';
5
- export { defaultSchema } from 'rehype-sanitize';
6
- import 'retext-smartypants';
package/dist/index.d.ts DELETED
@@ -1,6 +0,0 @@
1
- export { sanitizeHtml, stripTags } from './sanitize-html.js';
2
- export { stylizeText } from './stylize-text.js';
3
- export { transformMarkdown } from './transform-markdown.js';
4
- export { wrapCjk } from './wrap-cjk.js';
5
- export { defaultSchema } from 'rehype-sanitize';
6
- import 'retext-smartypants';
package/dist/index.js DELETED
@@ -1,2 +0,0 @@
1
- export{a as sanitizeHtml,b as stripTags}from'./chunk-FAO346AP.js';export{a as stylizeText}from'./chunk-22KUJHGV.js';export{a as transformMarkdown}from'./chunk-UEE5G5GV.js';export{a as wrapCjk}from'./chunk-IWTHDXJM.js';export{defaultSchema}from'rehype-sanitize';//# sourceMappingURL=index.js.map
2
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js","sourcesContent":[]}
@@ -1,2 +0,0 @@
1
- 'use strict';var r=require('rehype-parse'),n=require('rehype-sanitize'),p=require('rehype-stringify'),unified=require('unified');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var r__default=/*#__PURE__*/_interopDefault(r);var n__default=/*#__PURE__*/_interopDefault(n);var p__default=/*#__PURE__*/_interopDefault(p);function s(e,t){let i=unified.unified().use(r__default.default,{fragment:true}).use(n__default.default,t).use(p__default.default).processSync(e);return String(i)}var u=(e,t)=>s(e,{...t,tagNames:[]});exports.sanitizeHtml=s;exports.stripTags=u;//# sourceMappingURL=sanitize-html.cjs.map
2
- //# sourceMappingURL=sanitize-html.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/sanitize-html.ts"],"names":["sanitizeHtml","input","options","output","unified","rehypeParse","rehypeSanitize","rehypeStringify","stripTags"],"mappings":"+UAOO,SAASA,EAAaC,CAAeC,CAAAA,CAAAA,CAAiC,CAC3E,IAAMC,CAASC,CAAAA,eAAAA,EACZ,CAAA,GAAA,CAAIC,kBAAa,CAAA,CAAE,QAAU,CAAA,IAAK,CAAC,CAAA,CACnC,IAAIC,kBAAgBJ,CAAAA,CAAO,CAC3B,CAAA,GAAA,CAAIK,kBAAe,CAAA,CACnB,WAAYN,CAAAA,CAAK,CAEpB,CAAA,OAAO,MAAOE,CAAAA,CAAM,CACtB,KAGaK,CAAY,CAAA,CAACP,CAAeC,CAAAA,CAAAA,GACvCF,CAAaC,CAAAA,CAAAA,CAAO,CAAE,GAAGC,CAAS,CAAA,QAAA,CAAU,EAAG,CAAC","file":"sanitize-html.cjs","sourcesContent":["import rehypeParse from 'rehype-parse';\nimport rehypeSanitize from 'rehype-sanitize';\nimport rehypeStringify from 'rehype-stringify';\nimport { unified } from 'unified';\n\nimport type { Options as RehypeSanitizeOptions } from 'rehype-sanitize';\n\nexport function sanitizeHtml(input: string, options?: RehypeSanitizeOptions) {\n const output = unified()\n .use(rehypeParse, { fragment: true })\n .use(rehypeSanitize, options)\n .use(rehypeStringify)\n .processSync(input);\n\n return String(output);\n}\n\n// Handy shortcut for when you just want to strip tags from text\nexport const stripTags = (input: string, options?: RehypeSanitizeOptions) =>\n sanitizeHtml(input, { ...options, tagNames: [] });\n"]}
@@ -1,6 +0,0 @@
1
- import { Options } from 'rehype-sanitize';
2
-
3
- declare function sanitizeHtml(input: string, options?: Options): string;
4
- declare const stripTags: (input: string, options?: Options) => string;
5
-
6
- export { sanitizeHtml, stripTags };
@@ -1,6 +0,0 @@
1
- import { Options } from 'rehype-sanitize';
2
-
3
- declare function sanitizeHtml(input: string, options?: Options): string;
4
- declare const stripTags: (input: string, options?: Options) => string;
5
-
6
- export { sanitizeHtml, stripTags };
@@ -1,2 +0,0 @@
1
- export{a as sanitizeHtml,b as stripTags}from'./chunk-FAO346AP.js';//# sourceMappingURL=sanitize-html.js.map
2
- //# sourceMappingURL=sanitize-html.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"sanitize-html.js"}
@@ -1,2 +0,0 @@
1
- 'use strict';var retext=require('retext'),n=require('retext-smartypants');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var n__default=/*#__PURE__*/_interopDefault(n);function i(t,r){let e=retext.retext().use(n__default.default,r).processSync(t);return String(e)}exports.stylizeText=i;//# sourceMappingURL=stylize-text.cjs.map
2
- //# sourceMappingURL=stylize-text.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/stylize-text.ts"],"names":["stylizeText","input","options","output","retext","retextSmartypants"],"mappings":"0LAKO,SAASA,CAAAA,CAAYC,CAAeC,CAAAA,CAAAA,CAAoC,CAC7E,IAAMC,EAASC,aAAO,EAAA,CAAE,GAAIC,CAAAA,kBAAAA,CAAmBH,CAAO,CAAA,CAAE,WAAYD,CAAAA,CAAK,CAEzE,CAAA,OAAO,MAAOE,CAAAA,CAAM,CACtB","file":"stylize-text.cjs","sourcesContent":["import { retext } from 'retext';\nimport retextSmartypants from 'retext-smartypants';\n\nimport type { Options as RetextSmartypantsOptions } from 'retext-smartypants';\n\nexport function stylizeText(input: string, options?: RetextSmartypantsOptions) {\n const output = retext().use(retextSmartypants, options).processSync(input);\n\n return String(output);\n}\n"]}
@@ -1,5 +0,0 @@
1
- import { Options } from 'retext-smartypants';
2
-
3
- declare function stylizeText(input: string, options?: Options): string;
4
-
5
- export { stylizeText };
@@ -1,5 +0,0 @@
1
- import { Options } from 'retext-smartypants';
2
-
3
- declare function stylizeText(input: string, options?: Options): string;
4
-
5
- export { stylizeText };
@@ -1,2 +0,0 @@
1
- export{a as stylizeText}from'./chunk-22KUJHGV.js';//# sourceMappingURL=stylize-text.js.map
2
- //# sourceMappingURL=stylize-text.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"stylize-text.js"}
@@ -1,2 +0,0 @@
1
- 'use strict';var o=require('rehype-sanitize'),t=require('rehype-stringify'),m=require('rehype-wrap-cjk'),i=require('remark-parse'),p=require('remark-rehype'),n=require('remark-smartypants'),unified=require('unified');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var o__default=/*#__PURE__*/_interopDefault(o);var t__default=/*#__PURE__*/_interopDefault(t);var m__default=/*#__PURE__*/_interopDefault(m);var i__default=/*#__PURE__*/_interopDefault(i);var p__default=/*#__PURE__*/_interopDefault(p);var n__default=/*#__PURE__*/_interopDefault(n);function h(r){let e=unified.unified().use(i__default.default).use(n__default.default).use(p__default.default).use(m__default.default).use(o__default.default).use(t__default.default).processSync(r);return String(e)}exports.transformMarkdown=h;//# sourceMappingURL=transform-markdown.cjs.map
2
- //# sourceMappingURL=transform-markdown.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/transform-markdown.ts"],"names":["transformMarkdown","input","output","unified","remarkParse","remarkSmartyPants","remarkRehype","rehypeWrapCjk","rehypeSanitize","rehypeStringify"],"mappings":"ojBAQO,SAASA,CAAkBC,CAAAA,CAAAA,CAAe,CAC/C,IAAMC,EAASC,eAAQ,EAAA,CACpB,GAAIC,CAAAA,kBAAW,CACf,CAAA,GAAA,CAAIC,kBAAiB,CACrB,CAAA,GAAA,CAAIC,kBAAY,CAAA,CAChB,GAAIC,CAAAA,kBAAa,EACjB,GAAIC,CAAAA,kBAAc,CAClB,CAAA,GAAA,CAAIC,kBAAe,CAAA,CACnB,WAAYR,CAAAA,CAAK,CAEpB,CAAA,OAAO,MAAOC,CAAAA,CAAM,CACtB","file":"transform-markdown.cjs","sourcesContent":["import rehypeSanitize from 'rehype-sanitize';\nimport rehypeStringify from 'rehype-stringify';\nimport rehypeWrapCjk from 'rehype-wrap-cjk';\nimport remarkParse from 'remark-parse';\nimport remarkRehype from 'remark-rehype';\nimport remarkSmartyPants from 'remark-smartypants';\nimport { unified } from 'unified';\n\nexport function transformMarkdown(input: string) {\n const output = unified()\n .use(remarkParse)\n .use(remarkSmartyPants)\n .use(remarkRehype)\n .use(rehypeWrapCjk)\n .use(rehypeSanitize)\n .use(rehypeStringify)\n .processSync(input);\n\n return String(output);\n}\n"]}
@@ -1,3 +0,0 @@
1
- declare function transformMarkdown(input: string): string;
2
-
3
- export { transformMarkdown };
@@ -1,3 +0,0 @@
1
- declare function transformMarkdown(input: string): string;
2
-
3
- export { transformMarkdown };
@@ -1,2 +0,0 @@
1
- export{a as transformMarkdown}from'./chunk-UEE5G5GV.js';//# sourceMappingURL=transform-markdown.js.map
2
- //# sourceMappingURL=transform-markdown.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"transform-markdown.js"}
package/dist/wrap-cjk.cjs DELETED
@@ -1,2 +0,0 @@
1
- 'use strict';var t=require('rehype-parse'),o=require('rehype-sanitize'),i=require('rehype-stringify'),p=require('rehype-wrap-cjk'),unified=require('unified');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var t__default=/*#__PURE__*/_interopDefault(t);var o__default=/*#__PURE__*/_interopDefault(o);var i__default=/*#__PURE__*/_interopDefault(i);var p__default=/*#__PURE__*/_interopDefault(p);function a(r){let e=unified.unified().use(t__default.default,{fragment:true}).use(p__default.default).use(o__default.default).use(i__default.default).processSync(r);return String(e)}exports.wrapCjk=a;//# sourceMappingURL=wrap-cjk.cjs.map
2
- //# sourceMappingURL=wrap-cjk.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/wrap-cjk.ts"],"names":["wrapCjk","input","output","unified","rehypeParse","rehypeWrapCjk","rehypeSanitize","rehypeStringify"],"mappings":"2ZAMO,SAASA,EAAQC,CAAe,CAAA,CACrC,IAAMC,CAASC,CAAAA,eAAAA,GACZ,GAAIC,CAAAA,kBAAAA,CAAa,CAAE,QAAU,CAAA,IAAK,CAAC,CACnC,CAAA,GAAA,CAAIC,kBAAa,CACjB,CAAA,GAAA,CAAIC,kBAAc,CAClB,CAAA,GAAA,CAAIC,kBAAe,CACnB,CAAA,WAAA,CAAYN,CAAK,CAEpB,CAAA,OAAO,MAAOC,CAAAA,CAAM,CACtB","file":"wrap-cjk.cjs","sourcesContent":["import rehypeParse from 'rehype-parse';\nimport rehypeSanitize from 'rehype-sanitize';\nimport rehypeStringify from 'rehype-stringify';\nimport rehypeWrapCjk from 'rehype-wrap-cjk';\nimport { unified } from 'unified';\n\nexport function wrapCjk(input: string) {\n const output = unified()\n .use(rehypeParse, { fragment: true })\n .use(rehypeWrapCjk)\n .use(rehypeSanitize)\n .use(rehypeStringify)\n .processSync(input);\n\n return String(output);\n}\n"]}
@@ -1,3 +0,0 @@
1
- declare function wrapCjk(input: string): string;
2
-
3
- export { wrapCjk };
@@ -1,3 +0,0 @@
1
- declare function wrapCjk(input: string): string;
2
-
3
- export { wrapCjk };
package/dist/wrap-cjk.js DELETED
@@ -1,2 +0,0 @@
1
- export{a as wrapCjk}from'./chunk-IWTHDXJM.js';//# sourceMappingURL=wrap-cjk.js.map
2
- //# sourceMappingURL=wrap-cjk.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"wrap-cjk.js"}
@@ -1,20 +0,0 @@
1
- import rehypeParse from 'rehype-parse';
2
- import rehypeSanitize from 'rehype-sanitize';
3
- import rehypeStringify from 'rehype-stringify';
4
- import { unified } from 'unified';
5
-
6
- import type { Options as RehypeSanitizeOptions } from 'rehype-sanitize';
7
-
8
- export function sanitizeHtml(input: string, options?: RehypeSanitizeOptions) {
9
- const output = unified()
10
- .use(rehypeParse, { fragment: true })
11
- .use(rehypeSanitize, options)
12
- .use(rehypeStringify)
13
- .processSync(input);
14
-
15
- return String(output);
16
- }
17
-
18
- // Handy shortcut for when you just want to strip tags from text
19
- export const stripTags = (input: string, options?: RehypeSanitizeOptions) =>
20
- sanitizeHtml(input, { ...options, tagNames: [] });
@@ -1,20 +0,0 @@
1
- import rehypeSanitize from 'rehype-sanitize';
2
- import rehypeStringify from 'rehype-stringify';
3
- import rehypeWrapCjk from 'rehype-wrap-cjk';
4
- import remarkParse from 'remark-parse';
5
- import remarkRehype from 'remark-rehype';
6
- import remarkSmartyPants from 'remark-smartypants';
7
- import { unified } from 'unified';
8
-
9
- export function transformMarkdown(input: string) {
10
- const output = unified()
11
- .use(remarkParse)
12
- .use(remarkSmartyPants)
13
- .use(remarkRehype)
14
- .use(rehypeWrapCjk)
15
- .use(rehypeSanitize)
16
- .use(rehypeStringify)
17
- .processSync(input);
18
-
19
- return String(output);
20
- }
package/src/wrap-cjk.ts DELETED
@@ -1,16 +0,0 @@
1
- import rehypeParse from 'rehype-parse';
2
- import rehypeSanitize from 'rehype-sanitize';
3
- import rehypeStringify from 'rehype-stringify';
4
- import rehypeWrapCjk from 'rehype-wrap-cjk';
5
- import { unified } from 'unified';
6
-
7
- export function wrapCjk(input: string) {
8
- const output = unified()
9
- .use(rehypeParse, { fragment: true })
10
- .use(rehypeWrapCjk)
11
- .use(rehypeSanitize)
12
- .use(rehypeStringify)
13
- .processSync(input);
14
-
15
- return String(output);
16
- }