1
---
2
name: markstream-install
3
description: 'Install and configure Markstream streaming Markdown renderers for Vue, React, Svelte, Angular, Nuxt, and Vue 2 applications. Use for package selection, minimal peer dependencies, CSS order, SSR boundaries, streaming mode, and renderer setup.'
4
license: MIT
5
compatibility: 'JavaScript or TypeScript frontend project using Vue 3, Nuxt 3/4, Vue 2.6/2.7, React 18+, Next.js, Angular 20+, or Svelte 5.'
6
metadata:
7
source: https://github.com/Simon-He95/markstream-vue
8
documentation: https://markstream.simonhe.me/
9
---
10
11
# Markstream Install
12
13
Integrate the appropriate [Markstream](https://github.com/Simon-He95/markstream-vue) package into an existing application without installing unnecessary optional dependencies or weakening its security defaults.
14
15
Read [references/scenarios.md](references/scenarios.md) before choosing packages or peers.
16
17
## When to Use
18
19
Use this skill when the user asks to:
20
21
- add streaming Markdown rendering to an AI chat or document interface;
22
- install Markstream in Vue, Nuxt, React, Next.js, Svelte, Angular, or Vue 2;
23
- repair a broken Markstream installation, missing styles, or SSR failure;
24
- replace another Markdown renderer with Markstream;
25
- choose between static, smooth-streaming, and externally parsed AST input.
26
27
## Workflow
28
29
### 1. Inspect the host application
30
31
Before changing dependencies, inspect:
32
33
- the framework and version in `package.json`;
34
- the package manager lockfile;
35
- whether the application uses SSR;
36
- reset, Tailwind, UnoCSS, or design-system styles;
37
- required optional features: code highlighting, enhanced File/Diff surfaces, Monaco, Mermaid, D2, infographic blocks, or KaTeX.
38
39
Do not assume the Vue package is correct merely because the source repository is named `markstream-vue`. Select the framework-specific package from the scenario table.
40
41
### 2. Install the smallest dependency set
42
43
Install exactly one framework package. Add optional peers only when the requested UI uses their feature.
44
45
Examples:
46
47
```bash
48
npm install markstream-vue
49
npm install markstream-react
50
npm install markstream-svelte
51
npm install markstream-angular
52
npm install markstream-vue2
53
```
54
55
Preserve the repository's existing package manager. Do not install every optional peer preemptively.
56
57
### 3. Wire styles in the correct order
58
59
Import application resets before Markstream styles. Import package CSS explicitly; do not rely on component imports to inject it.
60
61
For Tailwind or UnoCSS, use the relevant package subpath in a component layer:
62
63
```css
64
@import 'markstream-vue/index.css' layer(components);
65
```
66
67
Use the matching package name for React, Svelte, Angular, or Vue 2. If math rendering is enabled, also import:
68
69
```css
70
@import 'katex/dist/katex.min.css';
71
```
72
73
Vue CLI 4 and other Webpack 4-based Vue 2 applications cannot resolve package export maps. In those projects, import the published file directly:
74
75
```ts
76
import 'markstream-vue2/dist/index.css'
77
```
78
79
### 4. Add the smallest working renderer
80
81
Prefer `content` for static documents and most streaming chat interfaces. Markstream's built-in smooth streaming can pace irregular token delivery without requiring the host to maintain an AST.
82
83
For Vue 3 chat surfaces, start with:
84
85
```vue
86
<MarkdownRender
87
mode="chat"
88
:content="markdown"
89
:final="false"
90
smooth-streaming="auto"
91
:fade="false"
92
typewriter
93
/>
94
```
95
96
For completed chat history, keep the same renderer mode and switch pacing off:
97
98
```vue
99
<MarkdownRender
100
mode="chat"
101
:content="markdown"
102
:final="true"
103
:smooth-streaming="false"
104
:fade="true"
105
:typewriter="false"
106
/>
107
```
108
109
In React, Svelte, and Angular, use the equivalent camelCase or framework binding syntax. Keep `smoothStreaming="auto"`, `fade=false`, and `typewriter=true` while streaming; use `smoothStreaming=false` and `typewriter=false` for completed history.
110
111
Use `nodes` plus `final` only when a worker, shared AST store, custom transform, or another application layer already owns parsing.
112
113
### 5. Handle framework-specific boundaries
114
115
- In Nuxt, keep browser-only optional peers behind client boundaries.
116
- In Next.js, use the root `markstream-react` entry inside a `'use client'` component for live SSE or WebSocket streams. Use `markstream-react/next` for SSR-first HTML with hydration, or `markstream-react/server` for server-only rendering.
117
- Use `markstream-svelte` only with Svelte 5.
118
- Confirm the Angular application meets the current `markstream-angular` version requirement.
119
- In Vue 3, use `mode="chat"` for AI chat, `mode="docs"` for rich documents, and `mode="minimal"` for lightweight non-chat surfaces.
120
- For long Vue 3 conversations or an existing message virtualizer, consult the Markstream performance guide before adding a second virtualizer.
121
122
### 6. Preserve safe defaults
123
124
HTML policy defaults to `safe`, and Mermaid uses strict mode. Do not broaden either setting unless the user explicitly identifies a trusted legacy surface that requires it. Scope any exception to that surface.
125
126
### 7. Validate
127
128
Run the smallest relevant build, typecheck, or test command. Confirm:
129
130
1. the selected package matches the framework;
131
2. only requested optional peers were added;
132
3. styles load after resets;
133
4. SSR pages do not evaluate browser-only peers on the server;
134
5. static content and at least one incremental update render correctly.
135
136
Report the selected package, added peers, CSS location, streaming input choice, and validation command.
137
138
## Official References
139
140
- [Installation](https://markstream.simonhe.me/guide/installation)
141
- [AI chat and streaming](https://markstream.simonhe.me/guide/ai-chat-streaming)
142
- [Performance](https://markstream.simonhe.me/guide/performance)
143
- [Troubleshooting](https://markstream.simonhe.me/guide/troubleshooting)
144
- [Component overrides](https://markstream.simonhe.me/guide/component-overrides)
145