markstream-vue 0.0.7 → 0.0.8-beta.1
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 +4 -1
- package/README.zh-CN.md +4 -1
- package/dist/exports.js +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +1 -1
- package/dist/index.px.css +1 -0
- package/dist/index.tailwind.css +1 -1
- package/dist/index2.js +1 -1
- package/dist/index3.js +1 -1
- package/dist/index4.js +1 -1
- package/dist/index5.js +1 -1
- package/dist/index7.js +1 -1
- package/dist/languageIconExtended.js +1 -0
- package/dist/tailwind.ts +0 -0
- package/package.json +6 -3
- package/dist/index8.js +0 -1
package/README.md
CHANGED
|
@@ -101,6 +101,7 @@ createApp({
|
|
|
101
101
|
```
|
|
102
102
|
|
|
103
103
|
Import `markstream-vue/index.css` after your reset (e.g., Tailwind `@layer components`) so renderer styles win over utility classes. Install optional peers such as `stream-monaco`, `shiki`, `stream-markdown`, `mermaid`, and `katex` only when you need Monaco code blocks, Shiki highlighting, diagrams, or math.
|
|
104
|
+
If your app intentionally scales root font size on mobile, use `markstream-vue/index.px.css` to avoid `rem`-based global scaling side effects.
|
|
104
105
|
|
|
105
106
|
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`.
|
|
106
107
|
|
|
@@ -178,6 +179,8 @@ Then use `<MarkdownRender :content="md" />` in your pages.
|
|
|
178
179
|
- `pnpm dev` — playground dev server
|
|
179
180
|
- `pnpm play:nuxt` — Nuxt playground dev
|
|
180
181
|
- `pnpm build` — library + CSS build
|
|
182
|
+
- `pnpm build:analyze` — build with bundle visualizer reports (`bundle-visualizer.html`, `bundle-visualizer-tailwind.html`)
|
|
183
|
+
- `pnpm size:check` — run dist + npm package size budget checks (same guard used in CI)
|
|
181
184
|
- `pnpm test` — Vitest suite (`pnpm test:update` for snapshots)
|
|
182
185
|
- `pnpm typecheck` / `pnpm lint` — type and lint checks
|
|
183
186
|
|
|
@@ -332,7 +335,7 @@ Parse hooks example (match server + client):
|
|
|
332
335
|
|
|
333
336
|
- Mermaid/KaTeX not rendering? Install the peer (`mermaid` / `katex`) and pass `:enable-mermaid="true"` / `:enable-katex="true"` or call the loader setters. If you load them via CDN script tags, the library will also pick up `window.mermaid` / `window.katex`.
|
|
334
337
|
- CDN + KaTeX worker: if you don't bundle `katex` but still want off-main-thread rendering, create and inject a worker that loads KaTeX via CDN (UMD) using `createKaTeXWorkerFromCDN()` + `setKaTeXWorker()`.
|
|
335
|
-
- Bundle size: peers are optional and not bundled; import only `markstream-vue/index.css` once
|
|
338
|
+
- Bundle size: peers are optional and not bundled; import only `markstream-vue/index.css` once; use Shiki (`MarkdownCodeBlockNode`) when Monaco is too heavy. Infrequent language icons are split into an async chunk and load on demand; call `preloadExtendedLanguageIcons()` during app idle if you want to avoid first-hit icon fallback.
|
|
336
339
|
- Custom UI: register components via `setCustomComponents` (global or scoped), then emit markers/placeholders in Markdown and map them to Vue components.
|
|
337
340
|
|
|
338
341
|
## 🆚 Why markstream-vue over a typical Markdown renderer?
|
package/README.zh-CN.md
CHANGED
|
@@ -102,6 +102,7 @@ createApp({
|
|
|
102
102
|
```
|
|
103
103
|
|
|
104
104
|
确保在 CSS reset(如 `@tailwind base` 或 `@unocss/reset`)之后导入 `markstream-vue/index.css`,最好放在 `@layer components` 中以避免 Tailwind/UnoCSS 覆盖组件样式。根据需求再按需安装可选 peer 依赖:`stream-monaco`(Monaco 代码块)、`shiki` + `stream-markdown`(Shiki 高亮)、`mermaid`(Mermaid 图表)、`katex`(数学公式)。
|
|
105
|
+
如果你的移动端会主动调大根字号(`html`/`body`),建议改用 `markstream-vue/index.px.css`,避免 `rem` 跟随根字号导致整体放大。
|
|
105
106
|
|
|
106
107
|
渲染器的 CSS 会作用于内部 `.markstream-vue` 容器下,以尽量降低对全局的影响;如果你脱离 `MarkdownRender` 单独使用导出的节点组件,请在外层包一层带 `markstream-vue` 类名的容器。
|
|
107
108
|
|
|
@@ -179,6 +180,8 @@ export default defineNuxtPlugin((nuxtApp) => {
|
|
|
179
180
|
- `pnpm dev` — playground 开发
|
|
180
181
|
- `pnpm play:nuxt` — Nuxt playground 开发
|
|
181
182
|
- `pnpm build` — 构建库与 CSS
|
|
183
|
+
- `pnpm build:analyze` — 带可视化报告的构建(输出 `bundle-visualizer.html`、`bundle-visualizer-tailwind.html`)
|
|
184
|
+
- `pnpm size:check` — 本地执行 dist + npm 包体积预算检查(与 CI 一致)
|
|
182
185
|
- `pnpm test` — Vitest 测试(快照用 `pnpm test:update`)
|
|
183
186
|
- `pnpm typecheck` / `pnpm lint` — 类型检查与 Lint
|
|
184
187
|
|
|
@@ -333,7 +336,7 @@ setCustomComponents('docs', {
|
|
|
333
336
|
|
|
334
337
|
- Mermaid / KaTeX 不显示?安装对应 peer(`mermaid` / `katex`),并传入 `:enable-mermaid="true"` / `:enable-katex="true"` 或调用 loader 设置函数。如果你是用 CDN `<script>` 引入,库也会自动读取 `window.mermaid` / `window.katex`。
|
|
335
338
|
- CDN + KaTeX worker:如果你不打包 `katex` 但仍希望公式在 worker 中渲染(不占主线程),可以用 `createKaTeXWorkerFromCDN()` 创建一个“CDN 加载 KaTeX”的 worker,然后通过 `setKaTeXWorker()` 注入。
|
|
336
|
-
- 体积问题:可选 peer 不会被打包,CSS 只需导入一次;对代码块可用 Shiki(`MarkdownCodeBlockNode`)替代 Monaco
|
|
339
|
+
- 体积问题:可选 peer 不会被打包,CSS 只需导入一次;对代码块可用 Shiki(`MarkdownCodeBlockNode`)替代 Monaco。低频语言图标已拆分为异步 chunk 并按需加载;如果希望首屏就避免图标回退,可在空闲时调用 `preloadExtendedLanguageIcons()` 预热。
|
|
337
340
|
- 自定义 UI:通过 `setCustomComponents`(全局或作用域)注册组件,在 Markdown 中放置占位标记并映射到 Vue 组件。
|
|
338
341
|
|
|
339
342
|
## 🆚 为什么选择 markstream-vue,而不是普通 Markdown 渲染器?
|