markstream-vue2 0.0.19 → 0.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -0
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +377 -346
- package/dist/index.px.css +1 -1
- package/dist/index.tailwind.css +1 -1
- package/dist/tailwind.ts +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -139,6 +139,55 @@ new Vue({
|
|
|
139
139
|
}).$mount('#app')
|
|
140
140
|
```
|
|
141
141
|
|
|
142
|
+
## Streaming best practices
|
|
143
|
+
|
|
144
|
+
- For high-frequency SSE / token streaming, prefer parsing outside the renderer and pass `nodes` instead of reparsing the whole `content` string every chunk.
|
|
145
|
+
- Keep `viewport-priority` enabled unless you explicitly want eager rendering. Mermaid / Monaco / D2 blocks now stay idle while offscreen and resume when they approach the viewport.
|
|
146
|
+
|
|
147
|
+
```vue
|
|
148
|
+
<template>
|
|
149
|
+
<MarkdownRender
|
|
150
|
+
:nodes="nodes"
|
|
151
|
+
:final="final"
|
|
152
|
+
:viewport-priority="true"
|
|
153
|
+
:defer-nodes-until-visible="true"
|
|
154
|
+
/>
|
|
155
|
+
</template>
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Heavy-node prop forwarding
|
|
159
|
+
|
|
160
|
+
`MarkdownRender` can forward framework-level props directly into specialized heavy renderers:
|
|
161
|
+
|
|
162
|
+
```vue
|
|
163
|
+
<template>
|
|
164
|
+
<MarkdownRender
|
|
165
|
+
:content="markdown"
|
|
166
|
+
:mermaid-props="{
|
|
167
|
+
showHeader: false,
|
|
168
|
+
renderDebounceMs: 180,
|
|
169
|
+
previewPollDelayMs: 500
|
|
170
|
+
}"
|
|
171
|
+
:d2-props="{ progressiveIntervalMs: 500 }"
|
|
172
|
+
:infographic-props="{ showHeader: false }"
|
|
173
|
+
/>
|
|
174
|
+
</template>
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Notes:
|
|
178
|
+
- Use kebab-case in templates: `mermaid-props`, `d2-props`, `infographic-props`.
|
|
179
|
+
- These props are forwarded to the built-in Mermaid / D2 / Infographic blocks and to custom `mermaid` / `d2` / `infographic` overrides registered with `setCustomComponents(...)`.
|
|
180
|
+
|
|
181
|
+
## Mermaid tuning
|
|
182
|
+
|
|
183
|
+
Common `mermaid-props` keys for streaming scenarios:
|
|
184
|
+
|
|
185
|
+
- `renderDebounceMs`: delay partial/full progressive work during rapid token bursts.
|
|
186
|
+
- `contentStableDelayMs`: how long source mode waits before auto-switching back to preview when content stabilizes.
|
|
187
|
+
- `previewPollDelayMs`: initial delay before preview polling tries to upgrade a partial preview into a full render.
|
|
188
|
+
- `previewPollMaxDelayMs`: cap for preview polling backoff.
|
|
189
|
+
- `previewPollMaxAttempts`: maximum retry count while the Mermaid source is still incomplete.
|
|
190
|
+
|
|
142
191
|
## Build and size checks
|
|
143
192
|
|
|
144
193
|
```bash
|