Vue and Nuxt streaming Markdown renderer for AI chat
markstream-vue renders Markdown that updates while an LLM response is streaming. Use it for Vue 3, Nuxt, VitePress, SSE, WebSocket, AI chat UIs, long Markdown answers, progressive Mermaid diagrams, KaTeX math, and streaming code blocks.
When to use markstream-vue
Use markstream-vue when:
- Content streams from an LLM, SSE, or WebSocket
- Incomplete Markdown states must not flicker
- Long AI responses or long documents matter
- Mermaid/KaTeX/code blocks appear during streaming
- You need Vue/Nuxt/VitePress component rendering
- You want raw
contentand pre-parsednodesboth supported - Mobile WebView
pxCSS for root-font scaling matters - You need a safe HTML policy without
v-html
Use a simpler alternative when:
- You only render short static Markdown in Vue
- You already have a sanitizer/plugin setup and don't need streaming UX
Quick Start
pnpm add markstream-vue<script setup lang="ts">
import MarkdownRender from 'markstream-vue'
import { ref } from 'vue'
import 'markstream-vue/index.css'
const content = ref('# Hello\n\nWaiting for the first chunk…')
const isDone = ref(false)
</script>
<template>
<MarkdownRender
mode="chat"
:content="content"
:final="isDone"
/>
</template>Append each incoming chunk to content, then set isDone.value = true when the stream closes. The chat preset already enables its streaming-oriented defaults; only override individual props when you need different behavior.
Key capabilities
- Two input paths:
contentfor raw Markdown strings andnodesfor pre-parsed AST - Safe HTML policy:
safeby default,escapefor literal text,trustedfor trusted content only — nov-htmlrequired - Progressive Mermaid: diagrams render incrementally during streaming
- Streaming code blocks:
stream-diffsFile/Diff surfaces - Virtualized long documents: bounded live nodes for 1MB+ content
- Optional peers:
stream-diffs, Mermaid, KaTeX, D2, Infographic — install only what you need - Mobile-ready:
index.px.cssfor apps that scale root font size - SSR-safe: worker imports and client-only guards for Nuxt/VitePress
Framework integration
| Integration | Guide |
|---|---|
| Vue 3 | Installation |
| Nuxt | Nuxt SSR |
| VitePress | Docs Site & VitePress |
| AI Chat / SSE | AI Chat & Streaming |
Optional peers
pnpm add mermaid katex # diagrams and math
pnpm add stream-diffs # enhanced File/Diff code blocks
pnpm add @antv/infographic @terrastruct/d2 # additional diagram typesTry it
Next steps
- Building a Vue AI chat UI? Read Vue AI chat Markdown renderer.
- Rendering raw LLM chunks? Read LLM token stream Markdown.
- Need Nuxt SSR? Read Nuxt streaming Markdown renderer.
- Comparing Vue alternatives? Read markstream-vue vs vue-stream-markdown.