TanStack Markdown has safe defaults, but it is not a general HTML sanitizer.
By default:
Relative URLs, fragments, HTTP, HTTPS, email, and telephone links remain available. Other explicit protocols, including data:, are removed.
allowHtml: true is an explicit trusted-content boundary:
renderHtml(source, { allowHtml: true })The HTML renderer emits raw nodes directly. The React renderer uses dangerouslySetInnerHTML. Do not enable this option for untrusted user content unless the result is sanitized with a policy appropriate for your application.
A highlighter returns HTML that is inserted into <code> without further escaping:
renderHtml(source, { highlighter })Only use a highlighter that escapes source code and returns trusted markup. TanStack Markdown cannot distinguish token markup from an injection in the returned string.
An extension renderHtml hook also returns trusted HTML. React component replacements can enforce application-specific link, image, and navigation policies, but those replacements are outside core renderer parity.
For user-generated Markdown:
The security regression suite covers executable protocols, raw HTML opt-in behavior, escaping, and React/HTML handling.