From b6a0ec92b3054215c80ed8f66aef7ca3b710ef04 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Sat, 27 Aug 2022 00:56:00 +0100 Subject: [PATCH] feat: allow iframe and video tags --- src/markdown/index.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/markdown/index.ts b/src/markdown/index.ts index f6eeec1e..4558c0d6 100644 --- a/src/markdown/index.ts +++ b/src/markdown/index.ts @@ -41,11 +41,30 @@ export const renderPageContent = async (content: string): Promise => { .use(rehypeImage) .use(rehypeSanitize, { ...defaultSchema, + tagNames: [...(defaultSchema.tagNames || []), "video", "iframe"], attributes: { ...defaultSchema.attributes, div: [...(defaultSchema.attributes?.div || []), ["className"]], code: [["className"]], blockquote: allowedBlockquoteAttrs, + video: [ + ["className"], + ["src"], + ["controls"], + ["loop"], + ["muted"], + ["autoplay"], + ["playsinline"], + ], + iframe: [ + ["className"], + ["src"], + ["allowfullscreen"], + ["frameborder"], + ["width"], + ["height"], + ["allow"], + ], }, }) .use(rehypePrism, {