Skip to content

Commit ba2fbc4

Browse files
committed
fix: sanitize schema copy
1 parent 32e8c66 commit ba2fbc4

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

packages/bytemd/src/utils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import stringify from 'rehype-stringify';
1010
import ghSchema from 'hast-util-sanitize/lib/github.json';
1111
import { ViewerProps } from '.';
1212

13+
const schemaStr = JSON.stringify(ghSchema);
14+
1315
export function getProcessor({
1416
sanitize,
1517
plugins,
@@ -22,7 +24,7 @@ export function getProcessor({
2224

2325
p = p.use(remarkRehype, { allowDangerousHtml: true }).use(rehypeRaw);
2426

25-
let schema = ghSchema;
27+
let schema = JSON.parse(schemaStr);
2628
schema.attributes['*'].push('className'); // Add className
2729
if (sanitize) schema = sanitize(schema);
2830

0 commit comments

Comments
 (0)