markdown icon indicating copy to clipboard operation
markdown copied to clipboard

Feature request: allow sanitization configuration

Open StephenFluin opened this issue 3 years ago • 1 comments

I'd like to be able to pass a configuration option into rdmd.html(text,options) that lets me turn off some of the sanitization. For example, I'd like to allow iframes and script tags.

StephenFluin avatar Apr 16 '21 20:04 StephenFluin

Sorry for taking 2 years, but this should be possible with something like:

import { sanitizeSchema } from '@readme/markdown/sanitize.schema'
import * as rdmd from '@readme/markdown'

const schema = sanitizeSchema()
schema.strip = schema.strip.filter(tag => tag !== 'script')
schema.tagNames.push('iframe')

rdmd.html(text, { sanitize: schema })

kellyjosephprice avatar Feb 27 '23 18:02 kellyjosephprice