SuperAPIAI Directory

markstream-vue

github.com · AI developer platforms

Markstream is a family of Markdown renderers for AI chat and streaming output, covering Vue 3/Nuxt/VitePress, React/Next.js, Octane, SolidJS, Svelte, Angular, and Vue 2. It is designed for LLM token streams, SSE/WebSocket output, incomplete Markdown, and long AI replies, with support for Mermaid diagrams, KaTeX math formulas, streaming code blocks, SSR, and virtualized history. markstream-vue is the Vue 3 package in this family, providing the MarkdownRender component, pre-parsed node rendering, safe HTML policies, optional Mermaid/KaTeX/D2/Infographic integration, enhanced code blocks, virtual scrolling coordination, CSS exports, a Worker client subpath, and SSR imports. The project is TypeScript-first, and with the default configuration you can render directly after importing CSS, making it suitable for AI chat interfaces that need to stably display partial Markdown states, mobile WebViews, and progressive heavy-block rendering scenarios.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsLinux

About this tool

Markstream is a family of renderers for AI chat and streaming Markdown, primarily addressing the rendering problem of Markdown that is still changing while the user is reading it. The official recommendation: use marked, markdown-it, or react-markdown for completed, static Markdown documents; use Markstream when Markdown is still streaming and changing.

Purpose and positioning Markstream is designed specifically for streaming Markdown, suitable for scenarios such as AI chat, LLM token streams, SSE/WebSocket output, incomplete Markdown, and long AI replies, with the goal of reducing flicker and keeping memory predictable.

Main capabilities

  • Multi-framework support: use markstream-vue for Vue 3/Nuxt/VitePress; markstream-react for React/Next.js/Remix; markstream-octane for Octane; markstream-solid for SolidJS 1.9/SolidStart; markstream-svelte for Svelte 5; markstream-angular for Angular standalone; and markstream-vue2 for Vue 2.6/2.7. If you only need framework-agnostic parsing, use stream-markdown-parser; for streaming controller utilities, use markstream-core.
  • Two rendering modes: virtual windowing for long documents, keeping scrolling and memory stable; incremental batching for a "typing" effect, which can be set with max-live-nodes="0".
  • Progressive diagrams and streaming code blocks: supports progressive Mermaid rendering and stream-diffs streaming code blocks, which can update following the diff.
  • Input forms: supports raw Markdown strings or pre-parsed nodes, and allows custom framework components in Vue, React, Octane, SolidJS, Svelte, and Angular.
  • Stable interfaces: including MarkdownRender, streaming content rendering, pre-parsed node rendering, safe HTML policies, optional Mermaid/KaTeX/D2/Infographic integration, enhanced code blocks, virtual scrolling coordination, CSS export, Worker client subpath, and SSR imports for Vite/Nuxt/VitePress.
  • Security policy: For untrusted user-generated content, it is recommended to use htmlPolicy="escape" to render raw HTML as text.
  • Themes and styles: Renderer CSS is scoped within the internal .markstream-vue container to reduce global style conflicts; dark theme can be enabled via an ancestor .dark class or :is-dark="true".
  • Code blocks: 2.x removes the Monaco and stream-markdown code block runtimes; install the optional peer stream-diffs when enhanced code blocks and diff blocks are needed. When enhanced code blocks are not needed, you can set :render-code-blocks-as-pre="true".
  • Editing API: After installing stream-diffs >= 0.0.5, the CodeBlockNode ref exposes editing interfaces such as getSurface(), startEditing(), stopEditing(), undo(), redo(), applyEdits(), revealLine(), expandLine(), expandHunk(), setEditorActiveLine(), get/setCodeScrollLeft(), etc. startEditing() must be called after streaming ends.
  • SSR/Worker: Markdown can be pre-parsed on the server or in a Worker, and typed nodes rendered on the client, avoiding client-side parsing and maintaining SSR/hydration determinism; SSR + streaming handoff is also supported.

Usage Install markstream-vue 2.x (npm latest tag is stable): The installation command is not fully provided in the materials, so no specific command is provided for now. In Vue/Nuxt, import markstream-vue/index.css after reset, for example using @import 'markstream-vue/index.css' layer(components); so that renderer styles take precedence over utility classes. Install optional peer as needed: stream-diffs, mermaid, katex. Then use <MarkdownRender :content="md" /> in the page. Streaming rendering example: smooth-streaming is enabled by default in typewriter/incremental mode; if you need the original chunked rhythm, you can set :smooth-streaming="false". SSR/Worker example: Use parseMarkdownToStructure for pre-parsing; note that its streamParse default value is 'auto'; when MarkdownRender parses content itself, parseOptions.streamParse defaults to true.

Use cases

  • Streaming Markdown display in AI chat interfaces
  • LLM token streams, SSE/WebSocket output
  • Stable rendering of incomplete Markdown
  • Virtualized history for long AI replies
  • Mobile WebView rendering
  • Scenarios requiring Mermaid diagrams, KaTeX formulas, streaming code blocks, and diff blocks
  • Scenarios requiring deterministic output via SSR or Worker pre-parsing

Limitations and notes

  • 2.x removes the Monaco and stream-markdown code block runtimes; enhanced code blocks require installing stream-diffs.
  • @pierre/diffs 1.7 is ESM-first; under Webpack 4 / Vue CLI 4, enhanced code blocks fall back to plain <pre> rendering.
  • Do not switch the same chat message from mode="chat" to mode="docs" merely because the final state changes; keep the mode stable and instead adjust rhythm/animation properties such as smooth-streaming, typewriter, and fade.
  • If the application scales the root font size on mobile, use markstream-vue/index.px.css to avoid rem global scaling side effects.
  • Icon theme configuration is process-global state; it is recommended to use the exported helper functions to check or switch it before app.mount().
  • The materials do not provide specific pricing, fees, platform requirements, or complete installation commands, so none are provided for now.
Up/Down to navigate · Enter to open · ESC to closeBrowse all tools