markstream-vue 1.0.1-beta.3 → 1.0.1-beta.4
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 +25 -1
- package/README.zh-CN.md +25 -1
- package/dist/exports.js +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +24 -1
- package/dist/index.px.css +1 -1
- package/dist/index.tailwind.css +1 -1
- package/dist/tailwind.js +0 -0
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -161,6 +161,30 @@ Import `markstream-vue/index.css` after your reset (e.g., use `@import 'markstre
|
|
|
161
161
|
For untrusted user-generated content, prefer `htmlPolicy="escape"` so raw HTML is rendered as text.
|
|
162
162
|
If your app intentionally scales root font size on mobile, use `markstream-vue/index.px.css` to avoid `rem`-based global scaling side effects.
|
|
163
163
|
|
|
164
|
+
Choose the renderer mode by surface:
|
|
165
|
+
|
|
166
|
+
```vue
|
|
167
|
+
<!-- AI chat / SSE output: steady pacing, no opacity animation flicker -->
|
|
168
|
+
<MarkdownRender
|
|
169
|
+
mode="chat"
|
|
170
|
+
:content="message"
|
|
171
|
+
:final="isDone"
|
|
172
|
+
smooth-streaming="auto"
|
|
173
|
+
:fade="false"
|
|
174
|
+
/>
|
|
175
|
+
|
|
176
|
+
<!-- Rich docs: larger render batches, tooltips, and fade are enabled by default -->
|
|
177
|
+
<MarkdownRender
|
|
178
|
+
mode="docs"
|
|
179
|
+
:content="doc"
|
|
180
|
+
:final="true"
|
|
181
|
+
/>
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Use `mode="minimal"` when you want the same lightweight defaults as `chat`, but prefer a neutral mode name for non-chat surfaces. Avoid combining high-frequency `smooth-streaming` with `fade`; it can turn a steady stream into repeated opacity restarts.
|
|
185
|
+
For the same chat message, do not switch from `mode="chat"` to `mode="docs"` only because `final` changed. Keep the mode stable and switch pacing/animation props (`smooth-streaming`, `typewriter`, `fade`) instead; `docs` changes the default code renderer and layout strategy.
|
|
186
|
+
For docs pages that do not need Monaco-backed code blocks, set `:render-code-blocks-as-pre="true"`. If you want the rich Monaco-backed code-block UI, install `stream-monaco`; otherwise the renderer intentionally falls back to `<pre>` rendering.
|
|
187
|
+
|
|
164
188
|
Renderer CSS is scoped under an internal `.markstream-vue` container to minimize global style conflicts. If you render exported node components outside of `MarkdownRender`, wrap them in an element with class `markstream-vue`.
|
|
165
189
|
|
|
166
190
|
For dark theme variables, either add a `.dark` class on an ancestor, or pass `:is-dark="true"` to `MarkdownRender` to scope dark mode to the renderer.
|
|
@@ -175,7 +199,7 @@ Prefer the unified code-block `theme` prop for new integrations. When you render
|
|
|
175
199
|
/>
|
|
176
200
|
```
|
|
177
201
|
|
|
178
|
-
Language icons use the built-in `material` theme by default.
|
|
202
|
+
Language icons use the built-in `material` theme by default. For new integrations, inspect or switch icon themes with the exported helpers before `app.mount()`. The legacy `app.use(VueRendererMarkdown, { iconTheme })` option still works in 1.x, but prefer helpers because icon configuration is process-global state.
|
|
179
203
|
|
|
180
204
|
```ts
|
|
181
205
|
import { getRegisteredThemes, setIconTheme } from 'markstream-vue'
|
package/README.zh-CN.md
CHANGED
|
@@ -153,6 +153,30 @@ createApp({
|
|
|
153
153
|
确保在 CSS reset(如 `@tailwind base` 或 `@unocss/reset`)之后导入 `markstream-vue/index.css`,推荐使用 `@import 'markstream-vue/index.css' layer(components);` 以避免 Tailwind/UnoCSS 覆盖组件样式。根据需求再按需安装可选 peer 依赖:`stream-monaco`(Monaco 代码块)、`shiki` + `stream-markdown`(Shiki 高亮)、`mermaid`(Mermaid 图表)、`katex`(数学公式)。
|
|
154
154
|
如果你的移动端会主动调大根字号(`html`/`body`),建议改用 `markstream-vue/index.px.css`,避免 `rem` 跟随根字号导致整体放大。
|
|
155
155
|
|
|
156
|
+
按使用场景选择渲染模式:
|
|
157
|
+
|
|
158
|
+
```vue
|
|
159
|
+
<!-- AI 聊天 / SSE 输出:稳定节奏,不叠加透明度动画,避免闪烁 -->
|
|
160
|
+
<MarkdownRender
|
|
161
|
+
mode="chat"
|
|
162
|
+
:content="message"
|
|
163
|
+
:final="isDone"
|
|
164
|
+
smooth-streaming="auto"
|
|
165
|
+
:fade="false"
|
|
166
|
+
/>
|
|
167
|
+
|
|
168
|
+
<!-- 富文档:默认启用更大的渲染批次、tooltip 和 fade -->
|
|
169
|
+
<MarkdownRender
|
|
170
|
+
mode="docs"
|
|
171
|
+
:content="doc"
|
|
172
|
+
:final="true"
|
|
173
|
+
/>
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
当你想要和 `chat` 相同的轻量默认值,但当前页面不是聊天语义时,可以使用 `mode="minimal"`。避免把高频 `smooth-streaming` 和 `fade` 同时开启,否则稳定的流式输出可能变成反复重启的透明度动画。
|
|
177
|
+
同一条聊天消息不要仅因为 `final` 变为 `true` 就从 `mode="chat"` 切到 `mode="docs"`。保持 mode 稳定,只切换 `smooth-streaming`、`typewriter`、`fade` 等节奏/动画 props;`docs` 会改变默认代码块渲染器和布局策略。
|
|
178
|
+
如果文档页不需要 Monaco 代码块,建议设置 `:render-code-blocks-as-pre="true"`;如果需要富 Monaco 代码块 UI,请安装 `stream-monaco`,否则渲染器会按设计降级为 `<pre>` 渲染。
|
|
179
|
+
|
|
156
180
|
渲染器的 CSS 会作用于内部 `.markstream-vue` 容器下,以尽量降低对全局的影响;如果你脱离 `MarkdownRender` 单独使用导出的节点组件,请在外层包一层带 `markstream-vue` 类名的容器。
|
|
157
181
|
|
|
158
182
|
暗色变量可以通过给祖先节点加 `.dark`,或直接给 `MarkdownRender` 传入 `:is-dark="true"`(仅对渲染器生效)。
|
|
@@ -167,7 +191,7 @@ createApp({
|
|
|
167
191
|
/>
|
|
168
192
|
```
|
|
169
193
|
|
|
170
|
-
语言图标默认使用内置的 `material` theme
|
|
194
|
+
语言图标默认使用内置的 `material` theme。新接入建议在 `app.mount()` 之前通过导出的 helper 查看或切换 icon theme。旧的 `app.use(VueRendererMarkdown, { iconTheme })` 选项在 1.x 仍可用,但它会修改进程级全局状态,因此优先使用 helper。
|
|
171
195
|
|
|
172
196
|
```ts
|
|
173
197
|
import { getRegisteredThemes, setIconTheme } from 'markstream-vue'
|