feat: allow iframe and video tags

This commit is contained in:
DIYgod 2022-08-27 00:56:00 +01:00
parent 3489932bfd
commit b6a0ec92b3
No known key found for this signature in database
GPG Key ID: D159328F47A80DCA
1 changed files with 19 additions and 0 deletions

View File

@ -41,11 +41,30 @@ export const renderPageContent = async (content: string): Promise<Rendered> => {
.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, {