markstream-vue2 0.0.19-beta.8 → 0.0.19

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 CHANGED
@@ -174,6 +174,64 @@ Fix: align both to the same version (e.g. `2.6.14` or `2.7.16`).
174
174
  Cause: Vue 2.6 + Composition API missing `_setupProxy` patch, or plugin not installed.
175
175
  Fix: ensure `@vue/composition-api` is installed + `Vue.use(...)`, and update to the latest markstream-vue2 build.
176
176
 
177
+ ### Custom node renders trigger `infinite update loop`
178
+ Cause: in Vue 2.6 / Vue CLI 4, recursively mounting another `MarkdownRender` inside a custom node component can create a render loop when the parent renderer is still streaming.
179
+ Fix: prefer `NestedRenderer` for nested streaming content. If you only need static HTML output, `renderNestedMarkdownToHtml(...)` is still available.
180
+
181
+ ```ts
182
+ import { NestedRenderer } from 'markstream-vue2'
183
+
184
+ export default {
185
+ components: { NestedRenderer },
186
+ props: {
187
+ node: { type: Object, required: true },
188
+ },
189
+ }
190
+ ```
191
+
192
+ ```vue
193
+ <template>
194
+ <NestedRenderer
195
+ :node="node"
196
+ custom-id="chat-demo"
197
+ :custom-html-tags="['thinking']"
198
+ :typewriter="false"
199
+ :batch-rendering="false"
200
+ :viewport-priority="false"
201
+ :defer-nodes-until-visible="false"
202
+ />
203
+ </template>
204
+ ```
205
+
206
+ `NestedRenderer` keeps the inner content streamable, but switches the nested renderer to the `nodes` path so Vue 2.6 does not recurse through a second `content`-driven renderer.
207
+
208
+ If you cannot mount another renderer and just need a static nested body, use `renderNestedMarkdownToHtml(...)`:
209
+
210
+ ```ts
211
+ import { renderNestedMarkdownToHtml } from 'markstream-vue2'
212
+
213
+ export default {
214
+ props: {
215
+ node: { type: Object, required: true },
216
+ },
217
+ computed: {
218
+ renderedHtml() {
219
+ return renderNestedMarkdownToHtml(
220
+ { node: this.node },
221
+ {
222
+ customHtmlTags: ['thinking'],
223
+ customNodeClass(node) {
224
+ return node.type === 'thinking' ? 'thinking-node__nested' : ''
225
+ },
226
+ },
227
+ )
228
+ },
229
+ },
230
+ }
231
+ ```
232
+
233
+ This keeps deeply nested custom content streamable without recursively mounting a second `content`-driven `MarkdownRender` / `NodeRenderer`.
234
+
177
235
  ## Tailwind
178
236
 
179
237
  If your app uses Tailwind and you want to avoid shipping duplicated utility CSS, import the Tailwind-ready output instead: