rehype plugin to sanitize HTML.
npm install rehype-sanitize
Say we have the following file,
And our script,
example.js, looks as follows:
var fs =var rehype =var merge =var gh =var sanitize =var schema =data'settings' fragment: true
node example yields:
Remove potentially dangerous things from HTML, or more correct: keep only the safe things in a document.
The sanitation schema defines how and if nodes and properties should be cleaned.
The schema is documented in
Improper use of
rehype-sanitize can open you up to a
cross-site scripting (XSS) attack.
The defaults are safe, but deviating from them is likely unsafe.
rehype-sanitize after all other plugins, as other plugins are likely
hast-util-sanitize— Core utility that does the sanitation
This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.