markdown-sanitization-chain

Parses, sanitizes, and renders Markdown with marked.js, DOMPurify, and Mermaid for web apps.

Updated May 3, 2026
One-click install
npx skills add https://github.com/fabioc-aloha/Alex_ACT_Extension --skill markdown-sanitization-chain
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: markdown-sanitization-chain
Source: https://github.com/fabioc-aloha/Alex_ACT_Extension/tree/main/brain/skills/markdown-sanitization-chain
Command: npx skills add https://github.com/fabioc-aloha/Alex_ACT_Extension --skill markdown-sanitization-chain

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires marked, dompurify, mermaid, and includes scripts (resource) components.

What problem does it solve?

It prevents cross-site scripting (XSS) vulnerabilities when rendering user-supplied markdown by enforcing a strict render chain.

Core Features & Use Cases

  • Security: Sanitizes HTML generated from markdown to prevent malicious scripts from executing.
  • Compatibility: Supports rendering diagrams like Mermaid within sanitized content.
  • Use Case: When displaying user comments or embedded documentation that includes markdown and diagrams, this chain ensures safety and correctness.

Quick Start

Integrate the renderMarkdown function to parse, sanitize, and render markdown content safely in your web app.

Frequently Asked Questions about markdown-sanitization-chain

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I sanitize markdown to prevent XSS in web applications?

To sanitize markdown and prevent XSS, you must parse content and strip malicious scripts before outputting HTML. This Skill enforces a strict render chain using DOMPurify to ensure content integrity and prevent cross-site scripting.

Does DOMPurify work with Mermaid diagrams when sanitizing markdown?

Yes, DOMPurify works with Mermaid diagrams by supporting diagram rendering within sanitized content. This ensures compatibility so visual diagrams render safely without compromising XSS protection.

What is the best way to securely render user comments containing markdown?

The best way to securely render user comments containing markdown is implementing a strict render chain. This pipeline parses markdown, sanitizes generated HTML to prevent XSS, and safely renders diagrams for web applications.

Why does rendering user-supplied markdown cause XSS vulnerabilities?

Rendering user-supplied markdown causes XSS vulnerabilities because parsed markdown can generate unescaped HTML containing malicious scripts. Sanitizing the HTML output prevents these injected scripts from executing in web applications.

Can I use marked.js with DOMPurify to secure embedded documentation portals?

Yes, you can use marked.js with DOMPurify to secure embedded documentation portals. This combination parses markdown and sanitizes the output, preventing XSS while supporting safe diagram rendering for web applications.