@xsynaptic/unified-tools 1.0.0 → 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.
- package/dist/html-cjk.d.mts +15 -0
- package/dist/html-cjk.mjs +1 -0
- package/dist/html.d.mts +11 -0
- package/dist/html.mjs +1 -0
- package/dist/index.d.mts +7 -0
- package/dist/index.mjs +1 -0
- package/dist/markdown.d.mts +12 -0
- package/dist/markdown.mjs +1 -0
- package/dist/mdx.d.mts +6 -0
- package/dist/mdx.mjs +1 -0
- package/dist/text.d.mts +6 -0
- package/dist/text.mjs +1 -0
- package/package.json +19 -24
- package/src/__tests__/sanitize-html.test.ts +16 -16
- package/src/html-cjk.ts +53 -0
- package/src/html.ts +33 -0
- package/src/index.ts +5 -4
- package/src/markdown.ts +28 -0
- package/src/mdx.ts +22 -0
- package/src/{stylize-text.ts → text.ts} +5 -5
- package/dist/chunk-22KUJHGV.js +0 -2
- package/dist/chunk-22KUJHGV.js.map +0 -1
- package/dist/chunk-5R5TNRZ2.js +0 -2
- package/dist/chunk-5R5TNRZ2.js.map +0 -1
- package/dist/chunk-FAO346AP.js +0 -2
- package/dist/chunk-FAO346AP.js.map +0 -1
- package/dist/chunk-UEE5G5GV.js +0 -2
- package/dist/chunk-UEE5G5GV.js.map +0 -1
- package/dist/index.cjs +0 -2
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -6
- package/dist/index.d.ts +0 -6
- package/dist/index.js +0 -2
- package/dist/index.js.map +0 -1
- package/dist/sanitize-html.cjs +0 -2
- package/dist/sanitize-html.cjs.map +0 -1
- package/dist/sanitize-html.d.cts +0 -6
- package/dist/sanitize-html.d.ts +0 -6
- package/dist/sanitize-html.js +0 -2
- package/dist/sanitize-html.js.map +0 -1
- package/dist/stylize-text.cjs +0 -2
- package/dist/stylize-text.cjs.map +0 -1
- package/dist/stylize-text.d.cts +0 -5
- package/dist/stylize-text.d.ts +0 -5
- package/dist/stylize-text.js +0 -2
- package/dist/stylize-text.js.map +0 -1
- package/dist/transform-markdown.cjs +0 -2
- package/dist/transform-markdown.cjs.map +0 -1
- package/dist/transform-markdown.d.cts +0 -3
- package/dist/transform-markdown.d.ts +0 -3
- package/dist/transform-markdown.js +0 -2
- package/dist/transform-markdown.js.map +0 -1
- package/dist/wrap-cjk.cjs +0 -2
- package/dist/wrap-cjk.cjs.map +0 -1
- package/dist/wrap-cjk.d.cts +0 -5
- package/dist/wrap-cjk.d.ts +0 -5
- package/dist/wrap-cjk.js +0 -2
- package/dist/wrap-cjk.js.map +0 -1
- package/src/sanitize-html.ts +0 -20
- package/src/transform-markdown.ts +0 -20
- package/src/wrap-cjk.ts +0 -38
|
@@ -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};
|
package/dist/html.d.mts
ADDED
|
@@ -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};
|
package/dist/index.d.mts
ADDED
|
@@ -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
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};
|
package/dist/text.d.mts
ADDED
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": "
|
|
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
|
-
"
|
|
8
|
-
|
|
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.
|
|
18
|
-
"types": "dist/index.d.
|
|
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": "
|
|
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.
|
|
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.
|
|
58
|
+
"@eslint/js": "^9.39.2",
|
|
64
59
|
"@types/jest": "^30.0.0",
|
|
65
|
-
"eslint": "^9.
|
|
66
|
-
"eslint-plugin-
|
|
67
|
-
"eslint-plugin-unicorn": "^
|
|
68
|
-
"globals": "^16.
|
|
69
|
-
"prettier": "^3.
|
|
70
|
-
"
|
|
71
|
-
"typescript": "^5.
|
|
72
|
-
"typescript-eslint": "^8.
|
|
73
|
-
"vitest": "^
|
|
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.
|
|
70
|
+
"packageManager": "pnpm@10.26.2+sha512.0e308ff2005fc7410366f154f625f6631ab2b16b1d2e70238444dd6ae9d630a8482d92a451144debc492416896ed16f7b114a86ec68b8404b2443869e68ffda6"
|
|
76
71
|
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { stripTags } from '../
|
|
1
|
+
import { stripTags } from '../html.js';
|
|
2
2
|
|
|
3
3
|
const sampleText = [
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
for (const [input, output] of sampleText) {
|
|
18
|
+
test(input, () => {
|
|
19
|
+
expect(stripTags(input)).toEqual(output);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
22
|
});
|
package/src/html-cjk.ts
ADDED
|
@@ -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 {
|
|
2
|
-
export {
|
|
3
|
-
export { transformMarkdown } from './
|
|
4
|
-
export {
|
|
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';
|
package/src/markdown.ts
ADDED
|
@@ -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
|
-
|
|
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
|
-
|
|
9
|
+
return String(processor).trim();
|
|
10
10
|
}
|
package/dist/chunk-22KUJHGV.js
DELETED
|
@@ -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"]}
|
package/dist/chunk-5R5TNRZ2.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import t from'rehype-parse';import n from'rehype-sanitize';import o from'rehype-stringify';import u from'rehype-wrap-cjk';import {unified}from'unified';function m(e){let r=unified().use(t,{fragment:true}).use(u,{langCode:"zh"}).use(n).use(o).processSync(e);return String(r)}function c(e){let r=unified().use(t,{fragment:true}).use(u,{langCode:"ja"}).use(n).use(o).processSync(e);return String(r)}function y(e){let r=unified().use(t,{fragment:true}).use(u,{langCode:"ko"}).use(n).use(o).processSync(e);return String(r)}export{m as a,c as b,y as c};//# sourceMappingURL=chunk-5R5TNRZ2.js.map
|
|
2
|
-
//# sourceMappingURL=chunk-5R5TNRZ2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/wrap-cjk.ts"],"names":["wrapChinese","input","output","unified","rehypeParse","rehypeWrapCjk","rehypeSanitize","rehypeStringify","wrapJapanese","wrapKorean"],"mappings":"wJAMO,SAASA,CAAAA,CAAYC,CAAe,CAAA,CACzC,IAAMC,CAAAA,CAASC,OAAQ,EAAA,CACpB,GAAIC,CAAAA,CAAAA,CAAa,CAAE,QAAA,CAAU,IAAK,CAAC,EACnC,GAAIC,CAAAA,CAAAA,CAAe,CAAE,QAAA,CAAU,IAAK,CAAC,CACrC,CAAA,GAAA,CAAIC,CAAc,CAAA,CAClB,GAAIC,CAAAA,CAAe,CACnB,CAAA,WAAA,CAAYN,CAAK,CAAA,CAEpB,OAAO,MAAA,CAAOC,CAAM,CACtB,CAEO,SAASM,CAAaP,CAAAA,CAAAA,CAAe,CAC1C,IAAMC,CAASC,CAAAA,OAAAA,EACZ,CAAA,GAAA,CAAIC,EAAa,CAAE,QAAA,CAAU,IAAK,CAAC,CACnC,CAAA,GAAA,CAAIC,CAAe,CAAA,CAAE,QAAU,CAAA,IAAK,CAAC,CAAA,CACrC,GAAIC,CAAAA,CAAc,CAClB,CAAA,GAAA,CAAIC,CAAe,CAAA,CACnB,WAAYN,CAAAA,CAAK,CAEpB,CAAA,OAAO,MAAOC,CAAAA,CAAM,CACtB,CAEO,SAASO,CAAAA,CAAWR,CAAe,CAAA,CACxC,IAAMC,CAAAA,CAASC,OAAQ,EAAA,CACpB,GAAIC,CAAAA,CAAAA,CAAa,CAAE,QAAA,CAAU,IAAK,CAAC,CACnC,CAAA,GAAA,CAAIC,CAAe,CAAA,CAAE,QAAU,CAAA,IAAK,CAAC,CAAA,CACrC,GAAIC,CAAAA,CAAc,CAClB,CAAA,GAAA,CAAIC,CAAe,CAAA,CACnB,WAAYN,CAAAA,CAAK,CAEpB,CAAA,OAAO,MAAOC,CAAAA,CAAM,CACtB","file":"chunk-5R5TNRZ2.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 wrapChinese(input: string) {\n const output = unified()\n .use(rehypeParse, { fragment: true })\n .use(rehypeWrapCjk, { langCode: 'zh' })\n .use(rehypeSanitize)\n .use(rehypeStringify)\n .processSync(input);\n\n return String(output);\n}\n\nexport function wrapJapanese(input: string) {\n const output = unified()\n .use(rehypeParse, { fragment: true })\n .use(rehypeWrapCjk, { langCode: 'ja' })\n .use(rehypeSanitize)\n .use(rehypeStringify)\n .processSync(input);\n\n return String(output);\n}\n\nexport function wrapKorean(input: string) {\n const output = unified()\n .use(rehypeParse, { fragment: true })\n .use(rehypeWrapCjk, { langCode: 'ko' })\n .use(rehypeSanitize)\n .use(rehypeStringify)\n .processSync(input);\n\n return String(output);\n}\n"]}
|
package/dist/chunk-FAO346AP.js
DELETED
|
@@ -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"]}
|
package/dist/chunk-UEE5G5GV.js
DELETED
|
@@ -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 o=require('rehype-parse'),n=require('rehype-sanitize'),p=require('rehype-stringify'),unified=require('unified'),retext=require('retext'),S=require('retext-smartypants'),i=require('rehype-wrap-cjk'),k=require('remark-parse'),l=require('remark-rehype'),w=require('remark-smartypants');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var o__default=/*#__PURE__*/_interopDefault(o);var n__default=/*#__PURE__*/_interopDefault(n);var p__default=/*#__PURE__*/_interopDefault(p);var S__default=/*#__PURE__*/_interopDefault(S);var i__default=/*#__PURE__*/_interopDefault(i);var k__default=/*#__PURE__*/_interopDefault(k);var l__default=/*#__PURE__*/_interopDefault(l);var w__default=/*#__PURE__*/_interopDefault(w);function m(r,t){let e=unified.unified().use(o__default.default,{fragment:true}).use(n__default.default,t).use(p__default.default).processSync(r);return String(e)}var c=(r,t)=>m(r,{...t,tagNames:[]});function h(r,t){let e=retext.retext().use(S__default.default,t).processSync(r);return String(e)}function O(r){let t=unified.unified().use(k__default.default).use(w__default.default).use(l__default.default).use(i__default.default).use(n__default.default).use(p__default.default).processSync(r);return String(t)}function R(r){let t=unified.unified().use(o__default.default,{fragment:true}).use(i__default.default,{langCode:"zh"}).use(n__default.default).use(p__default.default).processSync(r);return String(t)}function P(r){let t=unified.unified().use(o__default.default,{fragment:true}).use(i__default.default,{langCode:"ja"}).use(n__default.default).use(p__default.default).processSync(r);return String(t)}function T(r){let t=unified.unified().use(o__default.default,{fragment:true}).use(i__default.default,{langCode:"ko"}).use(n__default.default).use(p__default.default).processSync(r);return String(t)}Object.defineProperty(exports,"defaultSchema",{enumerable:true,get:function(){return n.defaultSchema}});exports.sanitizeHtml=m;exports.stripTags=c;exports.stylizeText=h;exports.transformMarkdown=O;exports.wrapChinese=R;exports.wrapJapanese=P;exports.wrapKorean=T;//# sourceMappingURL=index.cjs.map
|
|
2
|
-
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
DELETED
|
@@ -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","wrapChinese","wrapJapanese","wrapKorean"],"mappings":"quBAOO,SAASA,CAAaC,CAAAA,CAAAA,CAAeC,CAAiC,CAAA,CAC3E,IAAMC,CAAAA,CAASC,eAAQ,EAAA,CACpB,GAAIC,CAAAA,kBAAAA,CAAa,CAAE,QAAA,CAAU,IAAK,CAAC,CACnC,CAAA,GAAA,CAAIC,mBAAgBJ,CAAO,CAAA,CAC3B,GAAIK,CAAAA,kBAAe,CACnB,CAAA,WAAA,CAAYN,CAAK,CAAA,CAEpB,OAAO,MAAA,CAAOE,CAAM,CACtB,CAGO,IAAMK,CAAY,CAAA,CAACP,EAAeC,CACvCF,GAAAA,CAAAA,CAAaC,CAAO,CAAA,CAAE,GAAGC,CAAAA,CAAS,QAAU,CAAA,EAAG,CAAC,ECd3C,SAASO,CAAYR,CAAAA,CAAAA,CAAeC,CAAoC,CAAA,CAC7E,IAAMC,CAAAA,CAASO,aAAO,EAAA,CAAE,GAAIC,CAAAA,kBAAAA,CAAmBT,CAAO,CAAA,CAAE,WAAYD,CAAAA,CAAK,EAEzE,OAAO,MAAA,CAAOE,CAAM,CACtB,CCDO,SAASS,CAAAA,CAAkBX,CAAe,CAAA,CAC/C,IAAME,CAAAA,CAASC,iBACZ,CAAA,GAAA,CAAIS,kBAAW,CAAA,CACf,GAAIC,CAAAA,kBAAiB,CACrB,CAAA,GAAA,CAAIC,kBAAY,CAAA,CAChB,GAAIC,CAAAA,kBAAa,CACjB,CAAA,GAAA,CAAIV,kBAAc,CAAA,CAClB,IAAIC,kBAAe,CAAA,CACnB,WAAYN,CAAAA,CAAK,CAEpB,CAAA,OAAO,MAAOE,CAAAA,CAAM,CACtB,CCbO,SAASc,CAAYhB,CAAAA,CAAAA,CAAe,CACzC,IAAME,CAASC,CAAAA,eAAAA,GACZ,GAAIC,CAAAA,kBAAAA,CAAa,CAAE,QAAA,CAAU,IAAK,CAAC,CACnC,CAAA,GAAA,CAAIW,kBAAe,CAAA,CAAE,QAAU,CAAA,IAAK,CAAC,CAAA,CACrC,GAAIV,CAAAA,kBAAc,EAClB,GAAIC,CAAAA,kBAAe,CACnB,CAAA,WAAA,CAAYN,CAAK,CAAA,CAEpB,OAAO,MAAA,CAAOE,CAAM,CACtB,CAEO,SAASe,CAAajB,CAAAA,CAAAA,CAAe,CAC1C,IAAME,EAASC,eAAQ,EAAA,CACpB,GAAIC,CAAAA,kBAAAA,CAAa,CAAE,QAAA,CAAU,IAAK,CAAC,CACnC,CAAA,GAAA,CAAIW,kBAAe,CAAA,CAAE,QAAU,CAAA,IAAK,CAAC,CAAA,CACrC,IAAIV,kBAAc,CAAA,CAClB,GAAIC,CAAAA,kBAAe,CACnB,CAAA,WAAA,CAAYN,CAAK,CAAA,CAEpB,OAAO,MAAA,CAAOE,CAAM,CACtB,CAEO,SAASgB,CAAWlB,CAAAA,CAAAA,CAAe,CACxC,IAAME,CAAAA,CAASC,eAAQ,EAAA,CACpB,GAAIC,CAAAA,kBAAAA,CAAa,CAAE,QAAA,CAAU,IAAK,CAAC,CACnC,CAAA,GAAA,CAAIW,kBAAe,CAAA,CAAE,QAAU,CAAA,IAAK,CAAC,CACrC,CAAA,GAAA,CAAIV,kBAAc,CAAA,CAClB,GAAIC,CAAAA,kBAAe,CACnB,CAAA,WAAA,CAAYN,CAAK,CAAA,CAEpB,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 wrapChinese(input: string) {\n const output = unified()\n .use(rehypeParse, { fragment: true })\n .use(rehypeWrapCjk, { langCode: 'zh' })\n .use(rehypeSanitize)\n .use(rehypeStringify)\n .processSync(input);\n\n return String(output);\n}\n\nexport function wrapJapanese(input: string) {\n const output = unified()\n .use(rehypeParse, { fragment: true })\n .use(rehypeWrapCjk, { langCode: 'ja' })\n .use(rehypeSanitize)\n .use(rehypeStringify)\n .processSync(input);\n\n return String(output);\n}\n\nexport function wrapKorean(input: string) {\n const output = unified()\n .use(rehypeParse, { fragment: true })\n .use(rehypeWrapCjk, { langCode: 'ko' })\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 { wrapChinese, wrapJapanese, wrapKorean } 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 { wrapChinese, wrapJapanese, wrapKorean } 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 wrapChinese,b as wrapJapanese,c as wrapKorean}from'./chunk-5R5TNRZ2.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":[]}
|
package/dist/sanitize-html.cjs
DELETED
|
@@ -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"]}
|
package/dist/sanitize-html.d.cts
DELETED
package/dist/sanitize-html.d.ts
DELETED
package/dist/sanitize-html.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"sanitize-html.js"}
|
package/dist/stylize-text.cjs
DELETED
|
@@ -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"]}
|
package/dist/stylize-text.d.cts
DELETED
package/dist/stylize-text.d.ts
DELETED
package/dist/stylize-text.js
DELETED
package/dist/stylize-text.js.map
DELETED
|
@@ -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 +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'),n=require('rehype-sanitize'),o=require('rehype-stringify'),u=require('rehype-wrap-cjk'),unified=require('unified');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var t__default=/*#__PURE__*/_interopDefault(t);var n__default=/*#__PURE__*/_interopDefault(n);var o__default=/*#__PURE__*/_interopDefault(o);var u__default=/*#__PURE__*/_interopDefault(u);function m(e){let r=unified.unified().use(t__default.default,{fragment:true}).use(u__default.default,{langCode:"zh"}).use(n__default.default).use(o__default.default).processSync(e);return String(r)}function c(e){let r=unified.unified().use(t__default.default,{fragment:true}).use(u__default.default,{langCode:"ja"}).use(n__default.default).use(o__default.default).processSync(e);return String(r)}function y(e){let r=unified.unified().use(t__default.default,{fragment:true}).use(u__default.default,{langCode:"ko"}).use(n__default.default).use(o__default.default).processSync(e);return String(r)}exports.wrapChinese=m;exports.wrapJapanese=c;exports.wrapKorean=y;//# sourceMappingURL=wrap-cjk.cjs.map
|
|
2
|
-
//# sourceMappingURL=wrap-cjk.cjs.map
|
package/dist/wrap-cjk.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/wrap-cjk.ts"],"names":["wrapChinese","input","output","unified","rehypeParse","rehypeWrapCjk","rehypeSanitize","rehypeStringify","wrapJapanese","wrapKorean"],"mappings":"2ZAMO,SAASA,CAAAA,CAAYC,CAAe,CAAA,CACzC,IAAMC,CAAAA,CAASC,eAAQ,EAAA,CACpB,GAAIC,CAAAA,kBAAAA,CAAa,CAAE,QAAA,CAAU,IAAK,CAAC,EACnC,GAAIC,CAAAA,kBAAAA,CAAe,CAAE,QAAA,CAAU,IAAK,CAAC,CACrC,CAAA,GAAA,CAAIC,kBAAc,CAAA,CAClB,GAAIC,CAAAA,kBAAe,CACnB,CAAA,WAAA,CAAYN,CAAK,CAAA,CAEpB,OAAO,MAAA,CAAOC,CAAM,CACtB,CAEO,SAASM,CAAaP,CAAAA,CAAAA,CAAe,CAC1C,IAAMC,CAASC,CAAAA,eAAAA,EACZ,CAAA,GAAA,CAAIC,mBAAa,CAAE,QAAA,CAAU,IAAK,CAAC,CACnC,CAAA,GAAA,CAAIC,kBAAe,CAAA,CAAE,QAAU,CAAA,IAAK,CAAC,CAAA,CACrC,GAAIC,CAAAA,kBAAc,CAClB,CAAA,GAAA,CAAIC,kBAAe,CAAA,CACnB,WAAYN,CAAAA,CAAK,CAEpB,CAAA,OAAO,MAAOC,CAAAA,CAAM,CACtB,CAEO,SAASO,CAAAA,CAAWR,CAAe,CAAA,CACxC,IAAMC,CAAAA,CAASC,eAAQ,EAAA,CACpB,GAAIC,CAAAA,kBAAAA,CAAa,CAAE,QAAA,CAAU,IAAK,CAAC,CACnC,CAAA,GAAA,CAAIC,kBAAe,CAAA,CAAE,QAAU,CAAA,IAAK,CAAC,CAAA,CACrC,GAAIC,CAAAA,kBAAc,CAClB,CAAA,GAAA,CAAIC,kBAAe,CAAA,CACnB,WAAYN,CAAAA,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 wrapChinese(input: string) {\n const output = unified()\n .use(rehypeParse, { fragment: true })\n .use(rehypeWrapCjk, { langCode: 'zh' })\n .use(rehypeSanitize)\n .use(rehypeStringify)\n .processSync(input);\n\n return String(output);\n}\n\nexport function wrapJapanese(input: string) {\n const output = unified()\n .use(rehypeParse, { fragment: true })\n .use(rehypeWrapCjk, { langCode: 'ja' })\n .use(rehypeSanitize)\n .use(rehypeStringify)\n .processSync(input);\n\n return String(output);\n}\n\nexport function wrapKorean(input: string) {\n const output = unified()\n .use(rehypeParse, { fragment: true })\n .use(rehypeWrapCjk, { langCode: 'ko' })\n .use(rehypeSanitize)\n .use(rehypeStringify)\n .processSync(input);\n\n return String(output);\n}\n"]}
|
package/dist/wrap-cjk.d.cts
DELETED
package/dist/wrap-cjk.d.ts
DELETED
package/dist/wrap-cjk.js
DELETED
package/dist/wrap-cjk.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"wrap-cjk.js"}
|
package/src/sanitize-html.ts
DELETED
|
@@ -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,38 +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 wrapChinese(input: string) {
|
|
8
|
-
const output = unified()
|
|
9
|
-
.use(rehypeParse, { fragment: true })
|
|
10
|
-
.use(rehypeWrapCjk, { langCode: 'zh' })
|
|
11
|
-
.use(rehypeSanitize)
|
|
12
|
-
.use(rehypeStringify)
|
|
13
|
-
.processSync(input);
|
|
14
|
-
|
|
15
|
-
return String(output);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function wrapJapanese(input: string) {
|
|
19
|
-
const output = unified()
|
|
20
|
-
.use(rehypeParse, { fragment: true })
|
|
21
|
-
.use(rehypeWrapCjk, { langCode: 'ja' })
|
|
22
|
-
.use(rehypeSanitize)
|
|
23
|
-
.use(rehypeStringify)
|
|
24
|
-
.processSync(input);
|
|
25
|
-
|
|
26
|
-
return String(output);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function wrapKorean(input: string) {
|
|
30
|
-
const output = unified()
|
|
31
|
-
.use(rehypeParse, { fragment: true })
|
|
32
|
-
.use(rehypeWrapCjk, { langCode: 'ko' })
|
|
33
|
-
.use(rehypeSanitize)
|
|
34
|
-
.use(rehypeStringify)
|
|
35
|
-
.processSync(input);
|
|
36
|
-
|
|
37
|
-
return String(output);
|
|
38
|
-
}
|