<!-- Source: https://markdown.svelte.page/compare/vs-unified-remark -->
<!-- Canonical: https://markdown.svelte.page/compare/vs-unified-remark -->
# Svelte Markdown vs unified / remark

AST Pipeline vs Component Renderer

## Overview

Compare unified/remark and @humanspeak/svelte-markdown: AST content pipelines versus a direct marked-based Svelte 5 renderer with practical defaults.

- **Svelte Markdown site:** https://markdown.svelte.page
- **Svelte Markdown npm:** https://www.npmjs.com/package/%40humanspeak%2Fsvelte-markdown
- **Svelte Markdown slug:** svelte-markdown
- **Category:** Content Processing Pipeline
- **Approach:** AST transformation pipeline
- **Website:** https://unifiedjs.com
- **GitHub:** https://github.com/remarkjs/remark
- **npm:** https://www.npmjs.com/package/unified

## Feature comparison

| Feature | @humanspeak/svelte-markdown | unified / remark | Notes |
| --- | --- | --- | --- |
| Svelte 5 Compatibility | Yes | Framework-agnostic |  |
| TypeScript Support | Yes | Yes |  |
| Output | Svelte components | Syntax tree or configured compiler output | unified itself is a processor; plugins decide whether the result is HTML, another tree, lint messages, or something else. |
| Custom Renderers | Svelte components | AST transformers |  |
| Token Caching | Yes | Manual |  |
| Plugin Ecosystem | Marked extensions | 200+ remark/rehype plugins |  |
| LLM Streaming Mode | writeChunk() / resetStream() | Via unified-stream | The unified ecosystem has a separate unified-stream package, but not a built-in Svelte markdown streaming mode. |
| Streaming HTML Output | Partial blocks reconcile when </tag> arrives | No | unified-stream chunks string-mode markdown but does not reconcile partial nested HTML blocks across chunks — that piece is left to the application. |
| Math (KaTeX) | Built-in extension (markedKatex) | Via remark-math + rehype-katex |  |
| AST Access | No | Yes |  |
| Learning Curve | Minimal | Steep (AST concepts) |  |
| Dependency Surface | One renderer package | Pipeline assembled from multiple packages |  |
| Setup | One component | Pipeline assembly required |  |

## Svelte Markdown strengths

- Svelte 5 runes-native — built for runes, not retrofitted
- TypeScript-first with full type safety
- Built-in token caching (50-200x faster re-renders on repeated content)
- LLM streaming with imperative writeChunk() / resetStream() API
- 24 markdown renderers + 83 HTML tag renderers — every override is a Svelte snippet
- First-class extensions: KaTeX math, Mermaid diagrams, GitHub alerts, footnotes
- Opt-in Shiki syntax highlighting (streaming-compatible, tree-shaken from core)
- Built-in XSS protection — protocol allowlist, event-handler stripping, attribute sanitization
- Allow/deny utilities (allowHtmlOnly, excludeRenderersOnly, etc.) for fine-grained control
- Drop-in component — works anywhere in your Svelte app
- Dead simple API — no pipeline assembly
- Lighter bundle — no AST infrastructure
- Renders directly to Svelte components

## unified / remark strengths

- Massive plugin ecosystem (200+ remark/rehype plugins)
- Full AST access for deep content transformation
- Powers MDsveX, Gatsby, Next.js, and many others
- Framework-agnostic content pipeline
- Content linting, validation, and transformation

## Svelte Markdown limitations

- Smaller community (newer project)
- Runtime-only (no build-time optimization)
- No AST access for deep transformations
- Smaller plugin ecosystem than unified

## unified / remark limitations

- Not a component — Svelte output requires application glue or another integration
- Steep learning curve (AST, visitors, transformers)
- Requires pipeline assembly with multiple packages
- Larger bundle footprint
- No Svelte-specific features

## Verdict

Choose unified/remark when you need deep AST transformations, content linting, or access to the massive plugin ecosystem. Choose @humanspeak/svelte-markdown for a simple, Svelte-native rendering experience that just works.

## Keywords

remark markdown, unified svelte, remark vs marked, svelte markdown parser
