Skip to content

Commit

Permalink
feat: add sanitize html option (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
lino-levan authored Jan 29, 2023
1 parent 580c4ad commit 4875bc5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export interface RenderOptions {
baseUrl?: string;
mediaBaseUrl?: string;
allowIframes?: boolean;
disableHtmlSanitization?: boolean;
}

export function render(markdown: string, opts: RenderOptions = {}): string {
Expand All @@ -59,6 +60,10 @@ export function render(markdown: string, opts: RenderOptions = {}): string {
renderer: new Renderer(),
});

if (opts.disableHtmlSanitization) {
return html;
}

const allowedTags = sanitizeHtml.defaults.allowedTags.concat([
"img",
"video",
Expand Down

0 comments on commit 4875bc5

Please sign in to comment.