quikdown documentation
Complete documentation for the quikdown markdown parser.
📚 Documentation
- Architecture - Parser design, phases, and implementation details
- Security Guide - Security model, XSS prevention, and safe usage
- API Reference - Complete API documentation with examples
- Plugin Development - How to create custom fence plugins
- Framework Integration - Using quikdown with React, Vue, Svelte, Angular
- Bidirectional Conversion - HTML to Markdown round-trip conversion
- AST Libraries - Markdown to AST, JSON, YAML conversion
- Lexer Implementation - Experimental lexer-based parser
🚀 Quick Links
📖 Overview
quikdown is a lightweight, secure markdown parser designed for chat and LLM outputs. It prioritizes:
- Security - All HTML is escaped by default
- Size - 9.3KB minified (core), 14.1KB with bidirectional support, zero dependencies
- Extensibility - Plugin system for custom rendering
- Simplicity - Easy to understand and audit
- Bidirectional - Convert HTML back to Markdown for WYSIWYG editing
🎯 Use Cases
- Chat applications
- LLM output rendering
- Comment systems
- Documentation
- Email templates
- Static site generation
💡 Design Philosophy
- Secure by Default - No XSS vulnerabilities without explicit opt-in
- Small & Fast - Optimized for size and performance
- Practical - Focuses on commonly used markdown features
- Extensible - Plugin system for customization
- Zero Dependencies - No supply chain risks
🔒 Security First
quikdown escapes all HTML by default. Trusted HTML can only be rendered through explicit fence plugins, making trust granular and intentional.
// Safe for untrusted input
const html = quikdown(userInput);
// Trusted HTML requires explicit plugin
const html = quikdown(markdown, {
fence_plugin: {
render: (content, lang) => {
if (lang === 'trusted-html' && isAdmin()) {
return content; // Only for trusted sources
}
}
}
});📦 Installation
npm install quikdownOr via CDN:
<script src="https://unpkg.com/quikdown/dist/quikdown.umd.min.js"></script>🌟 Features
Supported Markdown
- Headings (
#through######) - Bold (
**text**or__text__) - Italic (
*text*or_text_) - Strikethrough (
~~text~~) - Code (`
inlineand``blocks`) - Links (
[text](url)) - Images (
) - Lists (ordered and unordered with nesting)
- Tables (with alignment)
- Blockquotes (
> quote) - Horizontal rules (
---) - Line breaks (two spaces + newline)
Not Supported (Intentionally)
- Raw HTML passthrough (security)
- Reference-style links (complexity)
- Footnotes (uncommon in chat)
- Definition lists (uncommon)
🔧 Configuration
Options
inline_styles- Use inline CSS instead of classesfence_plugin- Custom code block renderer
Methods
quikdown(markdown, options)- Parse markdown to HTMLquikdown.configure(options)- Create configured parserquikdown.emitStyles()- Get CSS stylesheetquikdown.version- Version string
🤝 Contributing
📄 License
BSD-2-Clause - See LICENSE
🙏 Acknowledgments
- Inspired by the simplicity of early markdown parsers
- Designed for the modern web with security in mind
- Built for real-world chat and LLM use cases