Skip to content

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 content and pre-parsed nodes both supported
  • Mobile WebView px CSS 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

bash
pnpm add markstream-vue
vue
<script setup>
import MarkdownRender from 'markstream-vue'
import 'markstream-vue/index.css'
</script>

<template>
  <MarkdownRender
    mode="chat"
    :content="streamingContent"
    :final="isDone"
    smooth-streaming="auto"
    :fade="false"
  />
</template>

Key capabilities

  • Two input paths: content for raw Markdown strings and nodes for pre-parsed AST
  • Safe HTML policy: safe by default, escape for literal text, trusted for trusted content only — no v-html required
  • Progressive Mermaid: diagrams render incrementally during streaming
  • Streaming code blocks: stream-diffs File/Diff surfaces or lightweight Shiki rendering
  • Virtualized long documents: bounded live nodes for 1MB+ content
  • Optional peers: stream-diffs, stream-markdown, Mermaid, KaTeX, D2, Infographic — install only what you need
  • Mobile-ready: index.px.css for apps that scale root font size
  • SSR-safe: worker imports and client-only guards for Nuxt/VitePress

Framework integration

IntegrationGuide
Vue 3Installation
NuxtNuxt SSR
VitePressDocs Site & VitePress
AI Chat / SSEAI Chat & Streaming

Optional peers

bash
pnpm add mermaid katex   # diagrams and math
pnpm add stream-diffs     # enhanced File/Diff code blocks
pnpm add @antv/infographic @terrastruct/d2  # additional diagram types

Try it

Next steps

FAQ

Is Markstream only for Vue?

No. Markstream includes Vue, React, Svelte, Angular, Vue 2, parser, and core packages, but markstream-vue is the most mature renderer.

Should I use markstream-vue for short static Markdown?

Use a simpler Markdown stack for short static Markdown. Use markstream-vue when streaming UX, incomplete Markdown states, long content, or heavy blocks matter.

Does markstream-vue work with Nuxt SSR?

Yes. Standard Markdown can render during Nuxt SSR, while browser-only optional peers upgrade after hydration.