diff --git a/packages/markdown/index.js b/packages/markdown/index.js index d630d8ec3..b824cf4f2 100644 --- a/packages/markdown/index.js +++ b/packages/markdown/index.js @@ -83,32 +83,6 @@ sanitize.tagNames.push('figcaption'); sanitize.tagNames.push('input'); // allow GitHub-style todo lists sanitize.ancestors.input = ['li']; -const toggleLoosemode = ({ loosemode = false }) => { - if (loosemode) { - const tags = ['iframe', 'button', 'label', 'input', 'video', 'source', 'script']; - const attr = [ - 'id', - 'style', - 'class', - 'height', - 'width', - 'src', - 'name', - 'checked', - 'controls', - 'type', - 'disabled', - 'placeholder', - '*', - ]; - tags.forEach(tag => { - sanitize.attributes[tag] = attr; - }); - sanitize.tagNames.push(...tags); - sanitize.required = {}; - delete sanitize.ancestors.input; - } -}; /** * Normalize Magic Block Raw Text */ @@ -167,7 +141,6 @@ export function processor(opts = {}) { export function plain(text, opts = options, components = {}) { if (!text) return null; - toggleLoosemode(opts); return processor(opts) .use(rehypeReact, { @@ -183,7 +156,6 @@ export function plain(text, opts = options, components = {}) { */ export function react(text, opts = options, components = {}) { if (!text) return null; - toggleLoosemode(opts); // eslint-disable-next-line react/prop-types const PinWrap = ({ children }) =>
{children}
; @@ -222,7 +194,6 @@ export function react(text, opts = options, components = {}) { */ export function html(text, opts = options) { if (!text) return null; - toggleLoosemode(opts); return processor(opts) .use(rehypeStringify) @@ -234,7 +205,6 @@ export function html(text, opts = options) { */ export function ast(text, opts = options) { if (!text) return null; - toggleLoosemode(opts); return processor(opts) .use(remarkStringify, opts.markdownOptions) @@ -246,7 +216,6 @@ export function ast(text, opts = options) { */ export function md(tree, opts = options) { if (!tree) return null; - toggleLoosemode(opts); return processor(opts) .use(remarkStringify, opts.markdownOptions)