Security
Content is untrusted.
MarkdownRaw HTML is text.
Only Markdown's own elements and registered blocks render. App-wide components can't be reached from Markdown.
script,style,iframe,objectand similar are removed, with their content. So areon*handlers,styleattributes (except a highlighter's colours inside code) and URLs that aren't relative,http(s),mailtoortel.<WriterContent>sanitizes again before rendering, so a stored document is safe even if it didn't come from this parser.
The checks are exported from @humanonlyweb/writer/parse: sanitize(nodes, isAllowed?), isSafeUrl(url) and NATIVE_TAGS.
What's left to you
Authors can set
classandidwith{…}. With untrusted authors and utility-class CSS (fixed inset-0), that's enough to restyle the page: strip them from parsed documents, or render those elements throughcomponents.Blocks get attributes as written. Validate any URL your block puts in an attribute other than
hreforsrc.CodeMirror injects
<style>elements. Under a strict CSP, passEditorView.cspNonce.of(nonce)inextensions.