From 0bc9f5d953da0e29da975af36f287880bf1f5a38 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Sun, 2 Oct 2022 16:02:57 +0100 Subject: [PATCH] feat: support inline style and style tag --- src/markdown/index.ts | 8 ++++++-- src/pages/dashboard/[subdomain]/editor.tsx | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/markdown/index.ts b/src/markdown/index.ts index b72120d9..1a48b8e3 100644 --- a/src/markdown/index.ts +++ b/src/markdown/index.ts @@ -72,10 +72,14 @@ export const renderPageContent = ( .use(rehypeImage, { env }) .use(rehypeSanitize, { ...defaultSchema, - tagNames: [...(defaultSchema.tagNames || []), "video", "iframe"], + tagNames: [...(defaultSchema.tagNames || []), "video", "iframe", "style"], attributes: { ...defaultSchema.attributes, - div: [...(defaultSchema.attributes?.div || []), ["className"]], + div: [ + ...(defaultSchema.attributes?.div || []), + ["className"], + ["style"], + ], code: [["className"]], blockquote: allowedBlockquoteAttrs, video: [ diff --git a/src/pages/dashboard/[subdomain]/editor.tsx b/src/pages/dashboard/[subdomain]/editor.tsx index 9666aeb5..d45d914c 100644 --- a/src/pages/dashboard/[subdomain]/editor.tsx +++ b/src/pages/dashboard/[subdomain]/editor.tsx @@ -343,7 +343,7 @@ export default function SubdomainEditor() { onChange={(e: ChangeEvent) => updateValue("tags", e.target.value) } - help="Separate multiple tags with commas" + help='Separate multiple tags with English commas ","' />