dsh-md-studio 0.0.0-stage → 1.1.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/CHANGELOG.md +55 -0
- package/LICENSE +21 -0
- package/README.en.md +129 -0
- package/README.md +157 -2
- package/THIRD_PARTY_NOTICES.md +370 -0
- package/cordis.patch.yml +4 -0
- package/docs/demo.md +94 -0
- package/docs/images/before-after.png +0 -0
- package/docs/images/demo-dark.png +0 -0
- package/docs/images/demo-light.png +0 -0
- package/docs/images/social-card.png +0 -0
- package/lib/client.js +4023 -0
- package/lib/client.js.LEGAL.txt +56 -0
- package/lib/index.js +3 -0
- package/package.json +49 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
本项目所有显著变更都记录在此文件中。格式遵循 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),版本遵循语义化版本。
|
|
4
|
+
|
|
5
|
+
## [1.1.1] - 2026-10-09
|
|
6
|
+
|
|
7
|
+
### 新增
|
|
8
|
+
|
|
9
|
+
- **Mermaid 语法自动修复**:首次渲染失败时,对 flowchart/graph 源做一次保守修复重试——为含英文括号的节点标签与边标签自动加引号(如 `W2[Codex / Claude Code (ACP)]`),成功后徽章显示"已自动修复";图形/圆柱等特殊形状括号不受影响。真实世界文档(如含 `(ACP)`、`(IM/Web)` 的架构图)无需改动原文即可渲染。
|
|
10
|
+
- 渲染失败提示补充常见错误说明;错误信息移到卡片工具栏下方,长源码时更易发现。
|
|
11
|
+
|
|
12
|
+
### 修复
|
|
13
|
+
|
|
14
|
+
- 测试脚本跨平台浏览器探测(Windows/macOS/Linux 系统浏览器与 Playwright 缓存),CI 可用。
|
|
15
|
+
|
|
16
|
+
## [1.1.0] - 2026-10-09
|
|
17
|
+
|
|
18
|
+
### 重写
|
|
19
|
+
|
|
20
|
+
- **接入方式重构**:不再创建独立预览面板或接管对话产物卡片,改为直接接管 DSH **原生右侧文件预览**的 Markdown 渲染器(`sidebar.right.tab.document` 插槽,官方 key,`priority: -100`)。文件读取、权限校验、分页累积、刷新、标签页生命周期全部保留 DSH 原生行为。
|
|
21
|
+
- **完全离线**:Mermaid 11.17、markdown-it、DOMPurify、highlight.js、KaTeX 与公式字体全部随包内置,渲染过程零网络请求。
|
|
22
|
+
|
|
23
|
+
### 新增
|
|
24
|
+
|
|
25
|
+
- KaTeX 行内 `$...$` 与块级 `$$...$$` 数学公式。
|
|
26
|
+
- 脚注(markdown-it-footnote)、任务列表、GFM 表格、标题锚点与文内跳转。
|
|
27
|
+
- Mermaid 图表卡片:图形/源码切换、全屏(缩放/拖拽)、下载 SVG、语法错误保留源码并给出原因。
|
|
28
|
+
- 代码高亮(highlight.js common 语言集)。
|
|
29
|
+
- 深浅主题跟随 DSH 主题自动重绘图表。
|
|
30
|
+
- 相对路径图片按文档目录解析,经 DSH 原生鉴权文件接口(`api/file`)读取。
|
|
31
|
+
- 文档级“查看源码”切换。
|
|
32
|
+
|
|
33
|
+
### 安全
|
|
34
|
+
|
|
35
|
+
- HTML 经 DOMPurify 净化:禁执行 `<script>`/`<iframe>` 等标签与事件属性;Mermaid 输出单独净化;`securityLevel: 'strict'`。
|
|
36
|
+
- 本地图片仅接受绝对路径或文档同目录相对路径,拒绝协议相对与控制字符。
|
|
37
|
+
|
|
38
|
+
### 修复(相对 1.0.0)
|
|
39
|
+
|
|
40
|
+
- 修复流程图节点文字被 SVG 净化误删的问题(`htmlLabels: false`)。
|
|
41
|
+
- 修复深色主题下表格文字对比度不足。
|
|
42
|
+
- 修复快速连续打开文件时的陈旧渲染竞态(渲染中止 + 卸载清理)。
|
|
43
|
+
|
|
44
|
+
### 测试
|
|
45
|
+
|
|
46
|
+
- 新增真实浏览器自动化测试(`node test/browser.mjs`):加载与发布一致的 bundle,验证 14 项能力,断言零外部网络请求、零页面异常。
|
|
47
|
+
- 新增截图脚本(`node test/screenshots.mjs`)。
|
|
48
|
+
|
|
49
|
+
### 兼容性
|
|
50
|
+
|
|
51
|
+
- 适配 DSH `0.2.0-rc.2` 客户端插槽 API;`engines.dsh` 声明 `>=0.2.0-rc.2 <0.3.0-0`。旧版 0.1.x 未验证。
|
|
52
|
+
|
|
53
|
+
## [1.0.0] - 2026-10-08
|
|
54
|
+
|
|
55
|
+
首个内部版本:独立分屏预览面板 + 对话内 Mermaid 增强 + 产物卡片行(整合 dsh-mermaid 与 dsh-artifact-preview 思路)。已被 1.1.0 的原生接入方案取代,不再维护。
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 BioAIEvolu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.en.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# 📄 Markdown Studio for DeepSeek Harness
|
|
4
|
+
|
|
5
|
+
**Mermaid diagrams, math formulas and syntax highlighting rendered right inside DSH's native right-sidebar file preview.**
|
|
6
|
+
|
|
7
|
+
The rendering engine ships with the plugin — **fully offline** · no document changes needed · disable to restore the stock renderer
|
|
8
|
+
|
|
9
|
+
[](https://github.com/BioAIEvolu/dsh-md-studio/actions/workflows/ci.yml)
|
|
10
|
+
[](https://github.com/BioAIEvolu/dsh-md-studio/releases)
|
|
11
|
+
[](LICENSE)
|
|
12
|
+
[](https://github.com/deepseek-ai/deepseek-harness)
|
|
13
|
+
[](README.md)
|
|
14
|
+
|
|
15
|
+
[The same Mermaid block: stock preview vs Markdown Studio](docs/images/before-after.png)
|
|
16
|
+
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Why
|
|
22
|
+
|
|
23
|
+
DeepSeek Harness's right-sidebar preview is great — except ` ```mermaid ` blocks show up as raw code. Existing workarounds open a separate panel or fetch rendering engines from a CDN.
|
|
24
|
+
|
|
25
|
+
**Markdown Studio takes over the native preview's Markdown renderer**: file reads, permission checks, reload and tab lifecycle all stay native — only the drawing is upgraded. Mermaid, markdown-it, KaTeX, highlight.js and DOMPurify ship **inside the bundle**, so diagrams work offline.
|
|
26
|
+
|
|
27
|
+
| Stock preview | Markdown Studio |
|
|
28
|
+
|---|---|
|
|
29
|
+
| ````mermaid` shown as code | Rendered in place as SVG + toolbar |
|
|
30
|
+
|
|
31
|
+
## ✨ Features
|
|
32
|
+
|
|
33
|
+
- **📈 Mermaid diagrams** — flowcharts, sequence, gantt, pie and the full Mermaid 11 family; per-diagram toolbar with **diagram/source toggle · fullscreen (zoom & pan) · SVG download**; automatic re-render on theme change
|
|
34
|
+
- **🩹 Syntax auto-repair** — the most common real-world breaker, ASCII parentheses inside node labels (`W2[Codex / Claude Code (ACP)]`), is repaired and rendered with an "auto-repaired" badge. No need to edit your documents
|
|
35
|
+
- **📐 KaTeX math** — inline `$...$` and display `$$...$$`
|
|
36
|
+
- **📝 Full GFM** — tables, task lists, footnotes, heading anchors
|
|
37
|
+
- **🎨 Syntax highlighting** — highlight.js common languages
|
|
38
|
+
- **🖼️ Local images** — relative paths resolve beside the document through DSH's authenticated file route
|
|
39
|
+
- **📴 Fully offline** — zero rendering network requests (asserted by automated tests); remote images authored in the document still load from their URLs
|
|
40
|
+
- **🛡️ Secure** — DOMPurify sanitization for both document HTML and diagram SVG; scripts never execute; Mermaid runs in `strict` mode
|
|
41
|
+
|
|
42
|
+
## 📸 Screenshots
|
|
43
|
+
|
|
44
|
+
| Dark | Light |
|
|
45
|
+
|---|---|
|
|
46
|
+
|  |  |
|
|
47
|
+
|
|
48
|
+
## 🚀 Install
|
|
49
|
+
|
|
50
|
+
> Requires DeepSeek Harness `0.2.0-rc.2+` (client slot API, see [Compatibility](#️-compatibility))
|
|
51
|
+
|
|
52
|
+
**Option 1 · In-app plugin market (dshmarket)** — search `dsh-md-studio`.
|
|
53
|
+
|
|
54
|
+
**Option 2 · CLI from GitHub**
|
|
55
|
+
```sh
|
|
56
|
+
dsh plugin --profile desktop add github:BioAIEvolu/dsh-md-studio
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Option 3 · CLI from npm (once published)**
|
|
60
|
+
```sh
|
|
61
|
+
dsh plugin --profile desktop add dsh-md-studio
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Restart DSH Desktop, then open any `.md` file in the right sidebar.
|
|
65
|
+
|
|
66
|
+
## 📖 Usage
|
|
67
|
+
|
|
68
|
+
- A **Markdown Studio** marker and a **source toggle** appear above the document
|
|
69
|
+
- Every Mermaid diagram gets its own toolbar: **diagram / source / fullscreen / download SVG**
|
|
70
|
+
- Fullscreen supports wheel zoom, drag pan and fit
|
|
71
|
+
- A broken diagram keeps its source plus the reason — other diagrams still render
|
|
72
|
+
- Disable the plugin anytime to restore the stock renderer
|
|
73
|
+
|
|
74
|
+
Try [docs/demo.md](docs/demo.md) — a document covering every feature.
|
|
75
|
+
|
|
76
|
+
## 🧠 How it works
|
|
77
|
+
|
|
78
|
+
No DOM scanning, no floating panel: the plugin registers on DSH's **official document-preview slot** and takes over the official Markdown key with higher priority.
|
|
79
|
+
|
|
80
|
+
```mermaid
|
|
81
|
+
flowchart LR
|
|
82
|
+
A[Open .md file] --> B[DSH native preview]
|
|
83
|
+
B --> C{document slot}
|
|
84
|
+
C -->|Markdown Studio| D[This renderer]
|
|
85
|
+
C -->|other types stay native| E[PDF / image / Excel / code]
|
|
86
|
+
D --> F[markdown-it + GFM]
|
|
87
|
+
D --> G[Mermaid]
|
|
88
|
+
D --> H[KaTeX]
|
|
89
|
+
F --> I[DOMPurify]
|
|
90
|
+
G --> I
|
|
91
|
+
I --> O[Right sidebar tab]
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
File reading, paging, reload and lifecycle remain DSH's job — the plugin only draws. Slot takeover is verified live via DSH Inspect: this plugin `active: true`, the official Markdown occupant yields.
|
|
95
|
+
|
|
96
|
+
## ✅ Quality
|
|
97
|
+
|
|
98
|
+
`node test/browser.mjs` loads the exact shipped bundle in a real Chromium with networking blocked (asserts **zero network requests, zero page errors**): 4 diagram types with visible labels, auto-repair, GFM, math, highlighting, toggles, fullscreen, SVG download, theme re-render, broken-diagram isolation, XSS sanitization, rapid file switching and disposal. Full list in the [Chinese README](README.md#-质量保障).
|
|
99
|
+
|
|
100
|
+
## ⚠️ Compatibility
|
|
101
|
+
|
|
102
|
+
- Built for **DSH `0.2.0-rc.2`** (`engines.dsh: >=0.2.0-rc.2 <0.3.0-0`); other versions unverified — open an issue if the slot API changes
|
|
103
|
+
- Limits: 2M chars per document, 50k chars / 2000 lines / 2000 edges per diagram
|
|
104
|
+
- Sanitized Mermaid output: diagram interactions and external references are disabled
|
|
105
|
+
|
|
106
|
+
## 🛠️ Build from source
|
|
107
|
+
|
|
108
|
+
```sh
|
|
109
|
+
pnpm install --ignore-scripts
|
|
110
|
+
node scripts/build.mjs # lib/ incl. fonts and license notices
|
|
111
|
+
node test/browser.mjs
|
|
112
|
+
node test/screenshots.mjs # regenerate docs images
|
|
113
|
+
pnpm pack
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
`lib/client.js` is shipped in DSH ModuleLoader factory format; only React is required from the host.
|
|
117
|
+
|
|
118
|
+
## 🙏 Credits
|
|
119
|
+
|
|
120
|
+
- [dsh-mermaid](https://github.com/MrmoLabs/dsh-mermaid) and [dsh-artifact-preview](https://github.com/nirvanaslash/dsh-artifact-preview) — inspiration for the interaction design
|
|
121
|
+
- Libraries: [Mermaid](https://mermaid.js.org/) · [markdown-it](https://github.com/markdown-it/markdown-it) · [DOMPurify](https://github.com/cure53/DOMPurify) · [highlight.js](https://highlightjs.org/) · [KaTeX](https://katex.org/) — full notices in [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md)
|
|
122
|
+
|
|
123
|
+
## ⭐ Support
|
|
124
|
+
|
|
125
|
+
If this plugin saves you time, please star the repo. Issues and PRs welcome — [中文文档](README.md).
|
|
126
|
+
|
|
127
|
+
## License
|
|
128
|
+
|
|
129
|
+
[MIT](LICENSE) © BioAIEvolu
|
package/README.md
CHANGED
|
@@ -1,3 +1,158 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# 📄 Markdown Studio for DeepSeek Harness
|
|
4
|
+
|
|
5
|
+
**在 DSH 原生右侧文件预览中,把 Markdown 里的 Mermaid 图表、数学公式、代码高亮一次看全。**
|
|
6
|
+
|
|
7
|
+
渲染引擎随插件内置,**完全离线可用** · 无需改动你的文档 · 停用即恢复官方渲染器
|
|
8
|
+
|
|
9
|
+
[](https://github.com/BioAIEvolu/dsh-md-studio/actions/workflows/ci.yml)
|
|
10
|
+
[](https://github.com/BioAIEvolu/dsh-md-studio/releases)
|
|
11
|
+
[](LICENSE)
|
|
12
|
+
[](https://github.com/deepseek-ai/deepseek-harness)
|
|
13
|
+
[](README.en.md)
|
|
14
|
+
|
|
15
|
+
[同一份 Mermaid 代码块:官方预览 vs Markdown Studio](docs/images/before-after.png)
|
|
16
|
+
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 为什么需要它
|
|
22
|
+
|
|
23
|
+
DeepSeek Harness 的右侧文件预览很好用,但 **Mermaid 代码块只会显示为一堆源码**——架构图、时序图、流程图全都要靠想象。外部方案要么需要开独立面板、要么依赖 CDN 联网。
|
|
24
|
+
|
|
25
|
+
**Markdown Studio 直接接管原生预览的 Markdown 渲染器**:文件读取、权限校验、刷新、标签页这些全部保留 DSH 原生行为,只有"画"的部分被增强。渲染引擎(Mermaid / markdown-it / KaTeX / highlight.js / DOMPurify)**随插件打包**,断网也能看图。
|
|
26
|
+
|
|
27
|
+
| 官方预览 | Markdown Studio |
|
|
28
|
+
|---|---|
|
|
29
|
+
| ````mermaid` 显示为代码块 | 就地渲染为 SVG 图 + 工具栏 |
|
|
30
|
+
| 长文档来回滚动 | 图文混排,所见即所得 |
|
|
31
|
+
|
|
32
|
+
## ✨ 特性
|
|
33
|
+
|
|
34
|
+
- **📈 Mermaid 图表**:流程图、时序图、甘特图、饼图等 Mermaid 11 全系图型;每张图带 **图形/源码切换 · 全屏(缩放/拖拽)· 下载 SVG** 工具栏;深浅主题自动重绘
|
|
35
|
+
- **🩹 语法自动修复**:真实文档里最常见的 `W2[Codex / Claude Code (ACP)]` 这类"标签含英文括号"语法错误,**自动修复后照常渲染**,并在徽章标注"已自动修复"——不用改你的文档
|
|
36
|
+
- **📐 KaTeX 数学公式**:行内 `$...$` 与块级 `$$...$$`
|
|
37
|
+
- **📝 完整 GFM**:表格、任务列表、脚注、删除线、标题锚点跳转
|
|
38
|
+
- **🎨 代码高亮**:highlight.js 常用语言集
|
|
39
|
+
- **🖼️ 本地图片**:相对路径按文档目录解析,经 DSH 原生鉴权接口读取
|
|
40
|
+
- **📴 完全离线**:渲染零网络请求(有自动化测试断言兜底);作者写在文档里的远程图片仍按原 URL 加载
|
|
41
|
+
- **🛡️ 安全**:DOMPurify 双重净化(文档 HTML + 图表 SVG),禁执行脚本;Mermaid `strict` 模式
|
|
42
|
+
|
|
43
|
+
## 📸 截图
|
|
44
|
+
|
|
45
|
+
| 深色主题 | |
|
|
46
|
+
|---|---|
|
|
47
|
+
|  |  |
|
|
48
|
+
| 深色 | 浅色 |
|
|
49
|
+
|
|
50
|
+
## 🚀 安装
|
|
51
|
+
|
|
52
|
+
> 需要 DeepSeek Harness `0.2.0-rc.2+`(客户端插槽 API 依赖,见 [兼容性](#️-兼容性))
|
|
53
|
+
|
|
54
|
+
**方式一 · 可视化插件市场(dshmarket)**
|
|
55
|
+
在 DSH 设置 → 插件 → 市场中搜索 `dsh-md-studio`。
|
|
56
|
+
|
|
57
|
+
**方式二 · 命令行(GitHub)**
|
|
58
|
+
```sh
|
|
59
|
+
dsh plugin --profile desktop add github:BioAIEvolu/dsh-md-studio
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**方式三 · 命令行(npm,发布后可用)**
|
|
63
|
+
```sh
|
|
64
|
+
dsh plugin --profile desktop add dsh-md-studio
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
安装后重启 DSH Desktop,在右侧打开任意 `.md` 文件即可。
|
|
68
|
+
|
|
69
|
+
## 📖 使用
|
|
70
|
+
|
|
71
|
+
打开 Markdown 文件后:
|
|
72
|
+
|
|
73
|
+
- 文档顶部出现 **Markdown Studio** 标识与 **查看源码** 按钮(整篇源码/渲染视图切换)
|
|
74
|
+
- 每个 Mermaid 图表自带工具栏:**图形 / 源码 / 全屏 / 下载 SVG**
|
|
75
|
+
- 全屏模式支持滚轮缩放、拖拽平移、一键适应
|
|
76
|
+
- 语法错误的图表保留源码并给出原因,**不影响文档里其他图表**
|
|
77
|
+
- 不想用了?在插件管理中停用,官方渲染器原样恢复
|
|
78
|
+
|
|
79
|
+
试试仓库里的 [docs/demo.md](docs/demo.md)——一份覆盖全部特性的验证文档。
|
|
80
|
+
|
|
81
|
+
## 🧠 工作原理
|
|
82
|
+
|
|
83
|
+
不扫描页面 DOM、不开独立窗口,而是注册 DSH 文档预览的**官方扩展插槽**,以更高优先级接管官方 Markdown 渲染键:
|
|
84
|
+
|
|
85
|
+
```mermaid
|
|
86
|
+
flowchart LR
|
|
87
|
+
A[打开 .md 文件] --> B[DSH 原生文件预览]
|
|
88
|
+
B --> C{document slot}
|
|
89
|
+
C -->|Markdown Studio 接管| D[本插件渲染器]
|
|
90
|
+
C -->|其他类型保持官方| E[PDF / 图片 / Excel / 代码]
|
|
91
|
+
D --> F[markdown-it + GFM]
|
|
92
|
+
D --> G[Mermaid 图表]
|
|
93
|
+
D --> H[KaTeX 公式]
|
|
94
|
+
F --> I[DOMPurify 净化]
|
|
95
|
+
G --> I
|
|
96
|
+
I --> O[右侧标签页渲染]
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
- 文件读取、分页、刷新、生命周期仍由 DSH 管理——插件只负责"画"
|
|
100
|
+
- 通过实时 Inspect 验证插槽注册:本插件 `active: true`,官方 Markdown 渲染器自动让位
|
|
101
|
+
|
|
102
|
+
## ✅ 质量保障
|
|
103
|
+
|
|
104
|
+
`node test/browser.mjs` 加载与发布完全一致的 bundle,在真实 Chromium 中断网验证(**零网络请求、零页面异常** 断言):
|
|
105
|
+
|
|
106
|
+
| 验证项 | |
|
|
107
|
+
|---|---|
|
|
108
|
+
| Mermaid 四类图渲染 + 节点文字可见 | ✅ |
|
|
109
|
+
| 含括号标签自动修复 | ✅ |
|
|
110
|
+
| GFM 表格 / 任务列表 / 脚注 | ✅ |
|
|
111
|
+
| 行内 + 块级 KaTeX | ✅ |
|
|
112
|
+
| 代码高亮 | ✅ |
|
|
113
|
+
| 图形/源码切换、全屏、SVG 下载 | ✅ |
|
|
114
|
+
| 深浅主题重绘 | ✅ |
|
|
115
|
+
| 非法图表隔离(一图坏不拖累整页) | ✅ |
|
|
116
|
+
| XSS 净化(脚本不执行) | ✅ |
|
|
117
|
+
| 快速切换文件无陈旧渲染 | ✅ |
|
|
118
|
+
| 卸载清理 | ✅ |
|
|
119
|
+
|
|
120
|
+
## ⚠️ 兼容性
|
|
121
|
+
|
|
122
|
+
- 适配 **DSH `0.2.0-rc.2`**(`engines.dsh: >=0.2.0-rc.2 <0.3.0-0`);其他版本未验证,升级 DSH 后如插槽 API 变更请提 issue
|
|
123
|
+
- 文档上限 200 万字符;单图 5 万字符 / 2000 行 / 2000 边
|
|
124
|
+
- Mermaid 输出经净化:图表内的交互点击、外部图片引用会被禁用
|
|
125
|
+
|
|
126
|
+
## 🛠️ 从源码构建
|
|
127
|
+
|
|
128
|
+
```sh
|
|
129
|
+
pnpm install --ignore-scripts
|
|
130
|
+
node scripts/build.mjs # 产出 lib/(含字体与三方授权清单)
|
|
131
|
+
node test/browser.mjs # 真实浏览器测试
|
|
132
|
+
node test/screenshots.mjs # 重新生成文档截图
|
|
133
|
+
pnpm pack # 打包 dsh-md-studio-x.y.z.tgz
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
构建产物 `lib/client.js` 为 DSH ModuleLoader 工厂格式,仅依赖宿主 React,其余依赖全部打包。
|
|
137
|
+
|
|
138
|
+
## 🗺️ Roadmap
|
|
139
|
+
|
|
140
|
+
- [ ] 对话内 Mermaid 渲染(与 [dsh-mermaid](https://github.com/MrmoLabs/dsh-mermaid) 互补)
|
|
141
|
+
- [ ] 图表导出 PNG
|
|
142
|
+
- [ ] 目录(TOC)侧栏
|
|
143
|
+
- [ ] 设置页(字号、图表方向)
|
|
144
|
+
|
|
145
|
+
## 🙏 致谢
|
|
146
|
+
|
|
147
|
+
- [dsh-mermaid](https://github.com/MrmoLabs/dsh-mermaid)(MrmoLabs)与 [dsh-artifact-preview](https://github.com/nirvanaslash/dsh-artifact-preview)(nirvanaslash)——1.0 版的整合来源,1.1 的交互设计参考
|
|
148
|
+
- 渲染库:[Mermaid](https://mermaid.js.org/) · [markdown-it](https://github.com/markdown-it/markdown-it) · [DOMPurify](https://github.com/cure53/DOMPurify) · [highlight.js](https://highlightjs.org/) · [KaTeX](https://katex.org/),完整授权见 [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md)
|
|
149
|
+
|
|
150
|
+
## ⭐ 支持项目
|
|
151
|
+
|
|
152
|
+
如果这个插件帮你省掉了"改文档语法"和"切窗口看图"的时间,欢迎点个 Star;问题与需求请提 [Issue](https://github.com/BioAIEvolu/dsh-md-studio/issues),PR 欢迎。
|
|
153
|
+
|
|
154
|
+
English documentation: [README.en.md](README.en.md)
|
|
155
|
+
|
|
156
|
+
## License
|
|
157
|
+
|
|
158
|
+
[MIT](LICENSE) © BioAIEvolu
|