dsh-markdown-studio 0.1.4 → 0.1.6
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 +24 -0
- package/README.en.md +2 -2
- package/README.md +2 -2
- package/dist/client.js +1 -1
- package/dist/client.studio.js +104 -104
- package/dist/index.js +136 -109
- package/dist/math.js +1 -1
- package/dist/mermaid.js +195 -195
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `dsh-markdown-studio` are documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.1.6] - 2026-11-21
|
|
6
|
+
|
|
7
|
+
### Security
|
|
8
|
+
- **Custom CSS Remote Resource Bypass Hardening**: Stripped CSS comments and backslash newline continuations before URL sanitization (`src/domain/custom-css.ts`), and added post-`var()` external `url()` blocking inside the CSS inliner (`src/css-inliner.ts`) so remote tracking URLs cannot be smuggled through CSS custom properties or split tokens.
|
|
9
|
+
- **Host Desktop Origin Allowlist**: Restricted non-HTTP(S) `Origin` headers on the local asset and AI routes (`host/http/routes.ts`, `host/http/ai-route.ts`) to explicit desktop shell schemes (`dsh-app:`, `dsh:`, `app:`, `file:`) instead of accepting arbitrary custom protocols.
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
- **Binary Image SHA-256 Hashing & Atomic Store Concurrency**: Fixed `ImageHostService` (`host/application/image-store.ts`) to hash raw PNG/JPEG `Buffer` bytes directly rather than UTF-8-corrupted strings, added random temp suffixes, cloned manifests immutably, and serialized all file writes/deletes through the manifest queue.
|
|
13
|
+
- **Drag-and-Drop `.md` Safety & Autosave Race Protection**: Dropping a `.md`/`.txt` file onto the editor (`src/app.ts`) now detaches any previously linked local file handle, resets active AI review state, and guards against article switches across async reads; debounced autosave tracks `(articleId, markdown)`, cancels cleanly on detach/switch, and syncs linked folder `assets/`.
|
|
14
|
+
- **Asset GC, Workspace & Archive Reliability**: Expanded `assetFilesInMarkdown` (`src/domain/images.ts`) to detect titled Markdown links, `./assets/`, `<img>`, and local server URLs; protected import-recovery snapshots, undo/redo history, and in-flight uploads from garbage collection; switched workspace open-file checks to async `isSameEntry` and blocked `.`/`..`; reconciled cross-`docs`/`trash` merge conflicts while guaranteeing non-empty `docs` after merge; and ensured switching articles preserves `updatedAt`.
|
|
15
|
+
- **Markdown Parser & CSS Inliner Edge Cases**: Fixed apostrophes/parentheses/currency inside table cells, currency `$100`/`$50` mixed with `$x+1$` formulas, intraword `C++17`/`a==1` guards with suffixed `==API==s`/`++UI++s`, nested `***` emphasis (`**a ***b*** c**`, `**bold and *italic***`, `**foo***`), apostrophes in link URLs, single-line editorial directives (`:::lead ...`) inside `:::scroll`, blockquote fenced code tracking, CSS `[attr$="..."]` selector splitting, `:is()`/`:not()`/`:where()` specificity, element-scoped CSS variables, and explicit `codeTheme` overriding custom theme `pre` colors.
|
|
16
|
+
- **Mermaid Concurrency & Dark Preview Lifecycle**: Fixed overlapping `ensure()` calls in `useMermaidAssets` so Mermaid diagrams never get stuck in `'loading'`; added CSS Color 4 `color(srgb ...)` parsing, `Darkmode.reset([])` cleanup with `data-plugin="dsh-markdown-studio"` tagging for leak-free repeated light/dark toggling, and full-width preview stage background alignment.
|
|
17
|
+
- **UI, Accessibility, Shortcuts & Mobile Polish**:
|
|
18
|
+
- Preserved AI word-diff colors and strikethrough inside immersive writing mode; restored editor focus after accepting/rejecting AI patches so immediate `⌘/Ctrl + Z` undo works.
|
|
19
|
+
- Raised WCAG 2 AA contrast for dark-mode danger confirmation buttons (`#dc2626`), `<del>` inside `:::tldr`/`blockquote` across all 8 built-in themes, and library search highlights/metadata.
|
|
20
|
+
- Eliminated compact-viewport clipping in the Skill Manager dialog (`720×680`), corrected the draft chip label (`新 Skill` / `Draft`), prevented search bar and outline/slash overlap, kept mobile (`<= 720px`) CSS Workbench drafts intact across preview toggles, increased mobile touch header/toolbar heights, added `Shift+Tab` outdent and shortcut modifier guards (`Ctrl+Tab`, `Shift+⌘/Ctrl+I`), made Settings Drawer tabs controlled, added workspace tree `ArrowLeft`/`ArrowRight` collapse/expand, started fresh documents scrolled at the top, and localized the cold-boot shell loading/error states.
|
|
21
|
+
|
|
22
|
+
## [0.1.5] - 2026-11-20
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
- **Native TeX Math Delimiter Compatibility (`\(...\)` & `\[...\]`)**: The Markdown parser now natively renders standard LaTeX inline `\(...\)` and single-line/multiline display `\[...\]` math alongside `$...$` and `$$...$$` — matching DeepSeek Harness host chat rendering with zero extra UI and zero mutation of user source (while editor shortcuts and slash commands continue to insert portable `$...$` / `$$...$$`). Code blocks, inline code, escaped backslashes (`\\(...\\)`), single-escaped brackets (`\[note]`), empty delimiters, and unclosed delimiters remain untouched.
|
|
26
|
+
|
|
5
27
|
## [0.1.4] - 2026-11-20
|
|
6
28
|
|
|
7
29
|
### Fixed
|
|
@@ -47,6 +69,8 @@ Initial public release.
|
|
|
47
69
|
- Host-side content-addressed PNG/JPEG store (`$DSH_HOME/storages/dsh-markdown-studio/assets/`) with magic-byte validation, authenticated write routes, automatic reference-counted garbage collection on permanent article deletion, and a read-only loopback server (`127.0.0.1:4010-4019`) so Markdown stays portable as `assets/<hash>.png`.
|
|
48
70
|
- Multi-article `localStorage` library with no artificial article/trash limits, future-schema overwrite protection, unreadable-payload preservation, keyword-highlighted search, conflict-aware merge dialog, `PK` magic-header `.zip` archive import/export (`4096` entries / `256 MiB` bounded decompression), and SHA-256 baseline conflict detection for local File System Access API `.md` / folder workspaces.
|
|
49
71
|
|
|
72
|
+
[0.1.6]: https://github.com/Geekhyt/dsh-markdown-studio/compare/v0.1.5...v0.1.6
|
|
73
|
+
[0.1.5]: https://github.com/Geekhyt/dsh-markdown-studio/compare/v0.1.4...v0.1.5
|
|
50
74
|
[0.1.4]: https://github.com/Geekhyt/dsh-markdown-studio/compare/v0.1.3...v0.1.4
|
|
51
75
|
[0.1.3]: https://github.com/Geekhyt/dsh-markdown-studio/compare/v0.1.2...v0.1.3
|
|
52
76
|
[0.1.2]: https://github.com/Geekhyt/dsh-markdown-studio/compare/v0.1.1...v0.1.2
|
package/README.en.md
CHANGED
|
@@ -109,7 +109,7 @@ Manage multiple drafts and a recycle bin with keyword-highlighted title and exce
|
|
|
109
109
|
|
|
110
110
|
## Why `dsh-markdown-studio`
|
|
111
111
|
|
|
112
|
-
- **Zero host patches, fast startup**: Built on official DeepSeek Harness plugin APIs with a `2.
|
|
112
|
+
- **Zero host patches, fast startup**: Built on official DeepSeek Harness plugin APIs with a `2.3 KiB` gzipped core shell; the editor, math, and diagram engines load only when needed so everyday chats pay zero overhead.
|
|
113
113
|
- **What you preview is what pastes into WeChat**: Eight high-contrast editorial themes compile cleanly into self-contained inline styles, collect external links into bottom references, preserve code indentation, and keep dark preview isolated from light clipboard output.
|
|
114
114
|
- **100% local-first, your data stays yours**: Drafts, recycle bin entries, custom themes, and deduplicated local images remain on your machine. Unused images are cleaned up automatically on permanent deletion, linked files warn before overwriting external edits, and full `.zip` backups keep everything portable (see [storage and archive formats](./docs/schema.md)).
|
|
115
115
|
|
|
@@ -119,7 +119,7 @@ Manage multiple drafts and a recycle bin with keyword-highlighted title and exce
|
|
|
119
119
|
| :--- | :--- | :--- |
|
|
120
120
|
| **8 editorial themes** | `Classic`, `Gallery`, `Insight`, `Botanical`, `Noir Gold`, `Anthology`, `Briefing`, `Poster` | Full-spectrum presets spanning crisp blue, museum stone, violet explainer, warm oat stationery, obsidian gold, celadon bookleaf, crimson executive brief, and bold yellow poster, plus named custom CSS themes |
|
|
121
121
|
| **Code highlighting** | `Follow theme` (8 custom per-theme surfaces) + `GitHub Light/Dark`, `One Dark`, `Dracula`, `Nord`, `Solarized Light/Dark`, `Monokai` | Code blocks adapt live to each theme or switch to dedicated editor palettes, with full custom CSS override support |
|
|
122
|
-
| **Extended syntax** | `:::lead`, `:::tldr`, `:::pull`, `:::meta`, `:::sign`, auto figure captions, GFM tables, task lists, footnotes, `==highlight==`, `++underline++`, 5 callout types, `:::scroll` / `:::scroll-x`, TeX math, Mermaid | One-click insertion via the Format menu, `/` slash palette, and shortcuts (**Settings → Help** reference), with full English and Chinese UI & sample articles; raw HTML is escaped by default and diagrams render in an isolated sandbox |
|
|
122
|
+
| **Extended syntax** | `:::lead`, `:::tldr`, `:::pull`, `:::meta`, `:::sign`, auto figure captions, GFM tables, task lists, footnotes, `==highlight==`, `++underline++`, 5 callout types, `:::scroll` / `:::scroll-x`, TeX math (`$...$` / `$$...$$` and `\(...\)` / `\[...\]`), Mermaid | One-click insertion via the Format menu, `/` slash palette, and shortcuts (**Settings → Help** reference), with full English and Chinese UI & sample articles; raw HTML is escaped by default and diagrams render in an isolated sandbox |
|
|
123
123
|
| **Custom Writing Skills** | Create, import, and export standard `SKILL.md` skills (ships with open-source `Humanize` / `去 AI 味` preset) | Selection-triggered floating pill (`⌘/Ctrl + J`), word-level red/green inline diff, and Markdown syntax preservation guards |
|
|
124
124
|
| **Import and export** | One-click WeChat rich HTML / plain text copy, `.md`, standalone `.html`, single-article `.zip`, full-library `.zip` archive, local folder sync | Automatically adapts file export across desktop and browser environments with conflict-aware merge and bundled local assets |
|
|
125
125
|
|
package/README.md
CHANGED
|
@@ -109,7 +109,7 @@ dsh plugin --profile desktop add dsh-markdown-studio
|
|
|
109
109
|
|
|
110
110
|
## 为什么选择 `dsh-markdown-studio`
|
|
111
111
|
|
|
112
|
-
- **官方接口实现,按需加载更轻快**:基于 DeepSeek Harness 官方插件接口构建,无任何宿主魔改;首屏核心包仅 `2.
|
|
112
|
+
- **官方接口实现,按需加载更轻快**:基于 DeepSeek Harness 官方插件接口构建,无任何宿主魔改;首屏核心包仅 `2.3 KiB`(gzip),编辑器、公式与流程图引擎仅在实际使用时按需加载,日常对话零负担。
|
|
113
113
|
- **所见即所得,粘贴公众号不走样**:8 套高对比度原创排版体系自动内联全部样式,外链自动收拢为文末参考资料,代码缩进完整保留,深色预览与浅色剪贴板严格隔离。
|
|
114
114
|
- **完全本地优先,数据主权归你**:草稿、回收站、自定义主题与自动去重的本地图片全部留在本机;彻底删除草稿时自动回收未引用图片,本地关联文件支持外部修改冲突提醒,并可随时导出完整 `.zip` 归档(详情见 [数据格式与容量](./docs/schema.md))。
|
|
115
115
|
|
|
@@ -119,7 +119,7 @@ dsh plugin --profile desktop add dsh-markdown-studio
|
|
|
119
119
|
| :--- | :--- | :--- |
|
|
120
120
|
| **8 套内置主题** | `经典`、`画廊`、`新知`、`森系`、`黑金`、`文集`、`简报`、`海报` | 覆盖白底蓝调、石版画廊、极光科普、草木信笺、曜石流金、宋刻天青、红白简报与明黄海报全色域,支持多套命名自定义 CSS 主题 |
|
|
121
121
|
| **代码块高亮** | `跟随主题`(8 套独立主题定制表面)+ `GitHub Light/Dark`、`One Dark`、`Dracula`、`Nord`、`Solarized Light/Dark`、`Monokai` | 代码块配色跟随当前主题实时联动或自由切换独立配色,并支持自定义 CSS 覆盖 |
|
|
122
|
-
| **扩展语法** | `:::lead` 导语、`:::tldr` 速览卡、`:::pull` 金句、`:::meta` 眉题、`:::sign` 落款、单图自动图注、GFM 表格、任务清单、脚注、`==高亮==`、`++下划线++`、5 类提示块、`:::scroll` / `:::scroll-x`、TeX
|
|
122
|
+
| **扩展语法** | `:::lead` 导语、`:::tldr` 速览卡、`:::pull` 金句、`:::meta` 眉题、`:::sign` 落款、单图自动图注、GFM 表格、任务清单、脚注、`==高亮==`、`++下划线++`、5 类提示块、`:::scroll` / `:::scroll-x`、TeX 公式(`$...$` / `$$...$$` 与 `\(...\)` / `\[...\]`)、Mermaid | 顶栏「格式」菜单、`/` 斜杠面板与快捷键一键插入(右侧「设置 → 帮助」附完整说明),支持完整中英双语界面与示例文章;默认安全转义原始 HTML 并在隔离环境中渲染图表 |
|
|
123
123
|
| **自定义写作 Skill** | 支持新建与导入导出标准 `SKILL.md` 自定义规则(附带开源 `去 AI 味` 预设) | 选中即浮现、快捷键 `⌘/Ctrl + J` 触发、词级红绿行内对比与 Markdown 语法保护 |
|
|
124
124
|
| **导入与导出** | 一键复制公众号富文本 / 纯文本、`.md`、独立 `.html`、单篇 `.zip` 文章包、整库 `.zip` 归档、本地文件夹同步 | 自动适配桌面与浏览器文件导出,支持冲突感知合并与完整图片素材打包 |
|
|
125
125
|
|
package/dist/client.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
window.__ModuleLoader__.load({ id: "dsh-markdown-studio", factory: (require) => {
|
|
2
2
|
var module = { exports: {} }; var exports = module.exports;
|
|
3
3
|
(function (module, exports, require) {
|
|
4
|
-
"use strict";var
|
|
4
|
+
"use strict";var h=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var K=Object.prototype.hasOwnProperty;var j=(e,t)=>{for(var o in t)h(e,o,{get:t[o],enumerable:!0})},A=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of I(t))!K.call(e,i)&&i!==o&&h(e,i,{get:()=>t[i],enumerable:!(r=D(t,i))||r.enumerable});return e};var W=e=>A(h({},"__esModule",{value:!0}),e);var V={};j(V,{create:()=>O});module.exports=W(V);function S(e,t,o){let[,r]=e.useState(0),[i,s]=e.useState(null);return e.useEffect(function(){if(t()||i!==null)return;let a=!1;return o().then(function(){a||r(function(u){return u+1})},function(u){a||s(u instanceof Error?u.message:String(u))}),function(){a=!0}},[i]),{error:i,retry:function(){s(null)}}}function k(e){let t=e.React.createElement,o=e.size||16;return t("svg",{width:o,height:o,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:e.active?1.3:1,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},t("rect",{x:2,y:2,width:12,height:12,rx:2.6}),t("path",{d:"M5 10.8V5.6l3 2.9 3-2.9v5.2"}))}var v="dsh-markdown-studio",E=`__dshPluginCss__:${v}`;function x(){let e=globalThis,t=e[E];if(t)return t;let o={mounted:!1,sheets:new Map};return e[E]=o,o}function C(){let e=x();e.mounted=!0,!(typeof document>"u"||!document.head)&&e.sheets.forEach((t,o)=>{let r=`style[data-plugin-css=${JSON.stringify(o)}]`;if(document.querySelector(r))return;let i=document.createElement("style");i.dataset.plugin=v,i.dataset.pluginCss=o,i.textContent=t,document.head.appendChild(i)})}function b(){let e=x();if(e.mounted=!1,typeof document>"u")return;document.querySelectorAll(`style[data-plugin=${JSON.stringify(v)}]`).forEach(o=>{typeof o.remove=="function"&&o.remove()})}var P="dsh-markdown-studio",L="dsh-markdown-studio.shell",T={"panel.label":"Markdown Studio","shell.loading":"Loading Markdown Studio\u2026","shell.failed":"Markdown Studio failed to load","shell.retry":"Retry"},B={"panel.label":"Markdown Studio","shell.loading":"\u6B63\u5728\u52A0\u8F7D Markdown Studio\u2026","shell.failed":"Markdown Studio \u52A0\u8F7D\u5931\u8D25","shell.retry":"\u91CD\u8BD5"};function H(e){let t=[],o=new Set(["en","zh","zh-CN"]);try{e.getSnapshot().locales.forEach(r=>{o.add(r.id)})}catch{}return o.forEach(r=>{try{let i=/^zh/i.test(r)?B:T,s=e.register(L,r,i);typeof s=="function"&&t.push(s)}catch{}}),()=>{t.forEach(r=>{try{r()}catch{}})}}function R(e,t,o){let r=null,i={get:s=>t.get(s),effect:s=>{let a=s();typeof a=="function"&&o.push(a)},slots:{inject:(s,a)=>(s==="main"&&a(),()=>{}),register:(s,a)=>(s.name==="main"&&(r=a),()=>{})}};return e.apply(i),r}function O(e,t,o){let r=e.createElement,i=o||(()=>Promise.reject(new Error("studio chunk loader missing"))),s=null,a=[],u=null,f=null,p=null,m=null;function g(n){if(m)try{let l=m(n);if(l&&l!==n)return l}catch{}return T[n]||n}function w(n){if(f=n,s){let l=R(n,s,a);l&&(u=l)}if(!u)throw new Error("Markdown Studio chunk did not register a main view");return u}function M(){return u?Promise.resolve(u):f&&s?Promise.resolve(w(f)):(p||(p=i().then(n=>(p=null,w(n)),n=>{throw p=null,n})),p)}function N(n){return k({React:e,size:n&&n.size?n.size:16,active:!!(n&&n.active)})}function _(n){let{error:l,retry:c}=S(e,()=>!!u,()=>M());return u?r(u,n):l?r("div",{role:"alert",style:{padding:"32px",color:"var(--dsw-alias-label-primary, #1f2329)",fontSize:"14px"}},r("p",{style:{margin:"0 0 12px",fontWeight:600}},g("shell.failed")),r("button",{type:"button",onClick:c,style:{padding:"6px 14px",borderRadius:"8px",border:"0.5px solid var(--dsw-alias-border-l2, rgba(15, 17, 21, 0.16))",background:"var(--dsw-alias-bg-layer-2, #f2f4f7)",color:"var(--dsw-alias-label-primary, #0f1115)",cursor:"pointer"}},g("shell.retry"))):r("div",{role:"status","aria-live":"polite",style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:"var(--dsw-alias-label-secondary, #646a73)",fontSize:"13px"}},g("shell.loading"))}function z(n){s=n;let l=n.get("locale"),c=null;n.effect(()=>{C();let y=[];if(a=y,l){y.push(H(l));try{c=l.bind(L),m=c}catch{c=null,m=null}}if(f){let d=R(f,n,y);d&&(u=d)}return()=>{for(a=[],s=null,m=null,u=null;y.length>0;){let d=y.pop();if(d)try{d()}catch{}}b()}}),n.slots.inject("sidebar.panellist",()=>n.slots.register({name:"sidebar.panellist",id:P,order:40,label:()=>c?c("panel.label"):"Markdown Studio"},N)),n.slots.inject("main",()=>n.slots.register({name:"main",key:P},_))}return{inject:["slots"],apply:z}}
|
|
5
5
|
})(module, exports, require);
|
|
6
6
|
var primitives = null;
|
|
7
7
|
try { primitives = require('@deepseek-ai/dsh-client-ui-primitives'); } catch (_e) {}
|