dsh-mermaid
其他 活跃维护

dsh-mermaid

bosenok/dsh-mermaid

在对话界面中无缝解析Mermaid围栏代码块并实时渲染为流程图、时序图等多种图表,所见即所得,方便技术沟通与方案交流,一键生成即可嵌入文档,无需复制到外部工具。

0
Stars 标星
0
Forks 分支
0
Watchers 关注
0
Open Issues
JavaScript
主要语言
MIT
开源协议
1.8 MB
仓库大小
1 个月前
最后推送
一键安装扩展 / 插件指令
dsh plugin --profile web add github:bosenok/dsh-mermaid
git clone https://github.com/bosenok/dsh-mermaid.git
git clone git@github.com:bosenok/dsh-mermaid.git
README.md develop

dsh-mermaid

Render mermaid fenced code blocks as diagrams in DSH markdown.

A DeepSeek Harness plugin,
packaged as a DSH bundle: package.json declares dsh.bundle.patch, and
cordis.patch.yml inserts the mermaid row into the active profile.
The client half is served from lib/client.js (dsh.client.platform: web).

Where it renders

The harness markdown renderer exposes no custom-code-block seam, so the client half
post-processes the rendered DOM: it finds fenced code that is a mermaid diagram, renders it
with mermaid and swaps the code view for the diagram. Because the sweep observes
document.body, every surface that renders markdown through the shared renderer is covered:

  • chat messages and the code cards they contain (including streaming and re-renders);
  • the right Sidebar document preview for .md/.markdown files — the diagram keeps the
    card header with its copy button and gains the plugin's zoom/fit toolbar;
  • theme switches re-render every diagram with the other palette.

Deliberately left as code: the plain-text source view of the preview
([data-textpreview-plain]), diff views, and blocks whose source only starts with a diagram
keyword (a list of keywords, prose that mentions graph TD).

Install

  • Desktop app: Plugins → install github:bosenok/dsh-mermaid (private repository:
    give the machine git access), then enable the bundle.
  • CLI: dsh plugin --profile <profile> add github:bosenok/dsh-mermaid.
  • Local checkout: dsh plugin --profile <profile> add file:/path/to/dsh-mermaid.

Enabling the bundle mounts the plugin; HMR applies it to a running app, and a
restart makes sure the client half is rebuilt.

Note for the app-managed desktop profile: dsh plugin --profile desktop add
only installs the dependency and copies the package; unlike a regular profile
it does not enable the bundle. Enable it by adding the package name to
dsh.profile.bundles in ~/.dsh/profiles/desktop/package.json (or through the
Plugins page). Other profiles enable the installed bundle automatically.

Versioning

This project follows Semantic Versioning (MAJOR.MINOR.PATCH).
Releases are tagged in git (v0.1.0 and later v0.1.x tags), announced
as GitHub releases and documented in CHANGELOG.md.

engines.dsh in package.json pins the compatible DSH range.

Bump policy: patch — fixes; minor — new features without breaking the
configuration; major — breaking changes to the configuration, the session
format or the supported DSH range.

CHANGELOG.md is generated with git-cliff from
Conventional Commits (cliff.toml):

./scripts/changelog.sh                 # print unreleased notes
./scripts/changelog.sh v0.2.0          # add the next release section
git cliff -o CHANGELOG.md              # full regeneration (curated history is kept otherwise)

To install a specific release instead of a moving branch, pin the tag:

dsh plugin --profile desktop add "git+ssh://git@github.com/bosenok/dsh-mermaid.git#v0.1.0"

Tags are created on master by Git Flow; integration builds live on develop
(install with #develop if you want the latest unreleased code).

Development

lib/ is built and committed; the sources live in src/. Rebuild the client with
the repository's Vite config (npx vite build → dist/, then the wrapper in
build/wrapper.js produces lib/client.js).

License

MIT — see LICENSE. Third-party code bundled into lib/ and its
licenses are listed in THIRD_PARTY_NOTICES.md.

Git Flow

Development follows Git Flow via the
committable .gitflow configuration. In a fresh clone activate it once:

./scripts/gitflow-setup.sh

(The script runs git flow config sync and creates the local master/develop
branches. git flow config sync alone is enough if both base branches already
exist.)

Branch Purpose
master released code only; every commit here is tagged vX.Y.Z
develop integration branch (repository default branch)
feature/* one change, started from and finished into develop
release/* stabilization, started from develop, finished into master + develop
hotfix/* urgent production fix, started from master, finished into both
git flow feature start my-change
# ... conventional commits: feat: …, fix: …, docs: …, chore: …
git flow feature finish my-change

git flow release start 0.2.0
# bump the version; update CHANGELOG.md (see Versioning)
git add -A && git commit -m "chore(release): v0.2.0"
git flow release finish 0.2.0        # merges to master + develop, creates the tag
git push origin master develop --tags