1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
x17 x17 x17 x17 x36 x36 x55 x55 x36 x36 |
// Imports
import type { Plugin } from "../renderer.ts"
import rehypeSanitize, { defaultSchema as defaults } from "rehype-sanitize"
export { defaults as schema }
/**
* Sanitize HTML.
*
* ```md
* <script>alert('foo')</script>
* ```
* ```html
* <p></p>
* ```
*/
export default create() as Plugin
/** Create a new HTML sanitization plugin. */
export function create(schema = defaults): Plugin {
return {
rehype(processor) {
return processor.use(rehypeSanitize, schema)
},
} as Plugin
}
|