Commit Graph
574 Commits
Author SHA1 Message Date
Libin YANG 0bbfe56b67 chore(deps): upgrade project dependencies (#1996)
Bump compatible releases, including wrangler 4.151.2, CodeMirror view 6.43.15, and typescript-eslint 8.72.0. Retarget the CodeMirror view patch and raise undici to 8.12.3 now that the HTTP/2 content-encoding regression is fixed.
2026-10-21 22:37:41 +08:00
Libin YANG f8d9126823 chore(deps): upgrade project dependencies (#1995)
Bump compatible releases, including pnpm 12.14.0 and wrangler 4.151.1, and retarget the Mermaid flowchart label patch to 12.2.0.
2026-10-17 10:12:56 +08:00
Libin YANG 1bdad48d20 fix(mermaid): stop flowchart labels from clipping (#1991)
Raise flowchart wrappingWidth to 300 so a typical bilingual line fits, and patch Mermaid so wider html labels wrap on fractional device pixel ratios instead of being clipped.

Closes #1989
2026-10-12 11:27:37 +08:00
Libin YANG d9132ab5a1 chore(deps): upgrade project dependencies (#1985) 2026-10-09 09:50:23 +08:00
dependabot[bot] a7c17fc4cd build(deps): bump the minor-and-patch group across 1 directory with 2 updates (#1980)
Bumps the minor-and-patch group with 2 updates in the / directory: [@cloudflare/vite-plugin](https://github.com/cloudflare/workers-sdk/tree/HEAD/packages/vite-plugin-cloudflare) and [wrangler](https://github.com/cloudflare/workers-sdk/tree/HEAD/packages/wrangler).


Updates `@cloudflare/vite-plugin` from 1.55.0 to 1.60.2
- [Release notes](https://github.com/cloudflare/workers-sdk/releases)
- [Changelog](https://github.com/cloudflare/workers-sdk/blob/main/packages/vite-plugin-cloudflare/CHANGELOG.md)
- [Commits](https://github.com/cloudflare/workers-sdk/commits/@cloudflare/vite-plugin@1.60.2/packages/vite-plugin-cloudflare)

Updates `wrangler` from 4.134.0 to 4.141.0
- [Release notes](https://github.com/cloudflare/workers-sdk/releases)
- [Commits](https://github.com/cloudflare/workers-sdk/commits/wrangler@4.141.0/packages/wrangler)

---
updated-dependencies:
- dependency-name: "@cloudflare/vite-plugin"
  dependency-version: 1.60.2
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: minor-and-patch
- dependency-name: wrangler
  dependency-version: 4.141.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-and-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-29 17:50:56 +08:00
Libin YANG 9bae922611 chore(deps): bump dependencies to latest compatible versions (#1978)
Upgrade pnpm to 12.6.0 and refresh direct packages, including VueUse 15,
Mermaid 12, and juice 12.2.0. Keep Prettier 2.8.8, TypeScript 6.0.3, and
the wrangler 4.134.0 preview-deploy pin.
2026-09-29 17:37:06 +08:00
Libin YANG 2cd2b354e6 chore(deps): bump pnpm, wrangler, CodeMirror, and related packages (#1972) 2026-09-22 19:54:26 +08:00
Libin YANG b732988fbf fix: persist drafts across GitHub login and accept pasted images (#1971)
Clipboard screenshots without a filename were rejected as invalid images.
Cancelling GitHub login from md-cli left a JSON error page, and drafts
could be lost because IndexedDB writes may not finish on unload.

Closes #1969
Closes #1970
2026-09-22 19:22:47 +08:00
Libin YANG cbcd3756e5 chore(deps): bump wrangler, vue, AWS SDK, and related packages (#1966)
Bump catalog wrangler and workers-types, plus web/vue toolchain
patch/minor updates. Intentionally leave prettier 2.8.8, typescript 6,
mermaid 11, vueuse 14, and pnpm 11 unchanged.
2026-09-18 11:42:30 +08:00
Libin YANG 8770fde1d2 chore(deps): bump wrangler, CodeMirror, vsce, and related packages (#1964) 2026-09-16 19:27:09 +08:00
Libin YANG a988db7bd2 chore(deps): bump pnpm, wrangler, lucide, and related packages (#1961)
Leave prettier, TypeScript, and mermaid on pinned majors.
2026-09-14 20:11:40 +08:00
Libin YANG f0d8c6170e chore(deps): bump vite, wrangler, AWS SDK, and related packages (#1960)
Raise the confbox override to 0.3.1 so pkg-types can import confbox/json. Leave prettier, TypeScript, and mermaid on pinned majors.
2026-09-12 16:39:30 +08:00
RandLibin YANG 0f95bb6395 fix(editor): gate SidebarAIToolbar by showAIToolbox preference (#1954)
Co-authored-by: Libin YANG <contact@yanglibin.info>
2026-09-10 19:08:32 +08:00
Libin YANG 75f09a0b44 perf(emoji): speed up search, panel, upload, and renderer scans (#1952)
Add pinyin/alias search, window the emoji grid, parallelize uploads, and bound emoji start() scans so long documents skip URL/time colons.
2026-09-10 11:05:58 +08:00
Libin YANG e14b55645c chore(deps): bump wrangler, vitest, isomorphic-dompurify, and related packages (#1951) 2026-09-10 10:22:35 +08:00
RandLibin YANG 9ec3f68e6d feat(emoji): add cloud sticker packs and an <Emoji> inline component (#1949)
Co-authored-by: Libin YANG <contact@yanglibin.info>
2026-09-10 10:05:36 +08:00
Libin YANG a9d3da04cc chore(deps): bump wrangler, CodeMirror, AWS SDK, and related packages (#1945) 2026-09-05 08:57:08 +08:00
Libin YANG 62cd665b16 chore(deps): bump pnpm, CodeMirror, AWS SDK, and related packages (#1943)
Refresh catalog, security overrides, and CI pnpm pins. Rebase the @codemirror/view patch onto 6.43.10.
2026-09-01 11:42:55 +08:00
Libin YANG 7622b816db chore(deps): bump wrangler, zod, and related packages (#1941)
Refresh catalog entries (@cloudflare/workers-types, wrangler, zod), the
tinyexec override, and direct deps across web, vscode, and md-cli, then
refresh transitive deps via `pnpm update -r` and `pnpm dedupe`.

Keep typescript at ~6.0.3 because @typescript-eslint 8.68.0 declares a
`typescript >=4.8.4 <6.1.0` peer range, so TS 7 would break lint.

Also drop the stale front-matter patch entry from AGENTS.md; that patch
was removed when front-matter was replaced.
2026-08-29 15:42:26 +08:00
Libin YANG 9227e937cf feat(theme): make link color and blockquote background configurable (#1939)
The same link colour (#576b95) was copy-pasted into all three built-in themes, and the blockquote background was only reachable through a shell-injected token, so both had to be overridden with custom CSS.

Link colour becomes an always-emitted --md-link-color, defaulting to the blue every theme already used. The theme-colour preset is stored as a literal var(--md-primary-color) so links keep tracking the primary colour rather than freezing its value at pick time.

Blockquote background cannot use the same shape: only the default theme has a background, while grace and simple are deliberately background-free. Declaring the variable unconditionally would give them a grey box they never had, so it is only declared when the user picks a non-default value and each theme keeps its own value as the var() fallback.

That relies on processCSS resolving a var() whose fallback is another var(), and on it leaving the unresolvable shell token intact. Both behaviours are now covered by tests, along with nested color-mix resolution.
2026-08-29 08:51:42 +08:00
Libin YANG 5adb849ac7 feat(theme): make line height and block spacing configurable (#1938)
Line height sat hard-coded as 1.75 in base.css and every vertical block margin was a literal in the theme CSS, so tightening or loosening an article meant hand-writing custom CSS across a dozen selectors.

Line height becomes --md-line-height. Block spacing becomes --md-block-spacing, a unitless multiplier applied to the margins each theme already defines rather than one flat value: a single length would collapse the theme's rhythm, where an h2 deliberately sits further from the text than a paragraph. Themes keep their proportions while the whole scale moves together.

The calc() indirection is safe for the WeChat paste because processCSS already flattens var() and calc() before juice inlines the styles; its multiplication branch handles a length times a unitless operand. cssVariables.test.ts pins that behaviour, which had no coverage before.

Both fields are optional end to end, so settings persisted before this change keep rendering identically and existing generateCSSVariables callers (VSCode preview, theme export) needed no signature change.
2026-08-29 08:43:55 +08:00
Libin YANG d5a2c4be76 feat(export): add segmented long-image PNG export (#1940)
A single full-height capture hits the browser canvas size limit on long
articles. Split the export into several PNGs on block boundaries so
paragraphs, headings, and code blocks are never cut in half, and package
multiple segments into a ZIP.
2026-08-29 08:34:48 +08:00
Libin YANG 83bf5583f5 feat(core): support GitHub-style emoji shortcodes (#1937)
Adds an inline extension turning 🚀 into an emoji character, so documents written on GitHub, Obsidian or Typora keep rendering the same glyphs instead of leaking raw shortcodes into the article.

The shortcode table is bundled in-repo rather than pulled from a dependency. The established emoji packages either carry several transitive dependencies or have negligible download counts, neither of which suits a widely used editor. The table is curated (515 entries) instead of the full ~1900-entry Unicode set, which would otherwise land in the deferred renderer chunk for a feature most articles use a handful of times.

Only names present in the table are consumed, so incidental colon pairs like 'ratio 3:4:5' and unknown names stay literal rather than disappearing. Emoji are emitted as bare characters with no wrapper element, leaving nothing for WeChat's sanitizer to strip and no theme CSS to keep in sync.
2026-08-29 08:27:51 +08:00
Libin YANG 91256df56a feat(core): add superscript syntax and theme strikethrough (#1936)
Superscript had no syntax at all, so ^2^ leaked through as literal text. Adds a markup_superscript inline extension rendering semantic <sup>, which degrades correctly even where the theme CSS is missing.

Unlike the sibling markup delimiters, superscript is meant to sit directly after a word char (x^2^), so it opts out of the shared word-boundary filtering and instead requires whitespace-free content. That keeps prose like 'a ^ b' and dangling carets like '2^10' literal. Ruby's [text]^(annotation) form is unaffected: its tokenizer is registered later and therefore runs first.

Subscript is deliberately left out because it would need the same single ~ delimiter already taken by the wavy-line extension.

Also gives <del> a theme class so strikethrough colour is themeable instead of relying on the browser default.
2026-08-29 08:14:00 +08:00
Libin YANG 1c2c2f4139 chore(deps): bump pnpm, wrangler, vue, and related packages (#1934)
Keep Prettier at 2.8.8 and TypeScript at 6.0.3 because vue-tsc still requires the TS 6 compiler API.
2026-08-28 10:19:17 +08:00
4e68effb82 feat(ai): add model discovery for chat and images (#1932)
Co-authored-by: Libin YANG <contact@yanglibin.info>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-28 09:46:52 +08:00
Libin YANG 48c6964bc6 chore(deps): bump js-yaml, AWS SDK, and related packages (#1933)
Upgrade catalog workers-types, marked, and isomorphic-dompurify. Treat empty YAML front matter as an empty mapping for js-yaml 5. Keep prettier 2.8.8 and typescript ~6.0.3.
2026-08-25 20:00:43 +08:00
Libin YANG 1a8dc8c073 refactor: replace yup and front-matter, upgrade MCP to 2.x (#1927) 2026-08-23 11:08:23 +08:00
Libin YANG e3275dbec0 fix(web): keep editor font stack when copying to WeChat (#1926)
Stop rewriting PingFang SC and other multi-word fonts to generic
families during juice sanitization, which made serif copy fall back
to sans-serif in the official account editor.

Closes #1916
2026-08-22 09:17:19 +08:00
Libin YANG b433d65c0c chore(deps): bump wrangler, eslint, and related packages (#1925)
Keep AWS SDK client and presigner on the same 3.1115.0 patch so @smithy/types stay aligned.
2026-08-22 08:42:16 +08:00
Libin YANG 03b4b78f0a perf: defer core renderer load and cap cloud sync payloads (#1924)
Lazy-load @md/core on the web app to shrink the initial bundle. Reject oversized sync pushes with plan quotas, client-side batches, and D1-safe row limits.
2026-08-21 16:48:50 +08:00
YangFong 04e43eff9e refactor: replace eslint-disable comments with clean code (#1923)
Remove eslint-disable-next-line annotations by using cleaner patterns: merge static classes, use void operator for intentional unused expressions, and rewrite a conditional assignment loop without no-cond-assign suppression.
2026-08-21 14:54:50 +08:00
Libin YANG 00cf64fcf1 chore(deps): bump workers-types, vite, mermaid, and related packages (#1922)
Bump catalog workers-types, uuid, and vitest; web AWS SDK, lucide,
Cloudflare vite-plugin, and vite; core mermaid and infographic.
Kept prettier 2.8.8, typescript ~6.0.3, and @types/vscode.
2026-08-20 20:30:01 +08:00
YangFong d7e8b9ca80 refactor: remove deprecated baseUrl from tsconfigs (#1921)
baseUrl is deprecated in TypeScript 6.0 and scheduled for removal in 7.0. Since TS 4.1, path aliases resolve relative to the tsconfig directory, so the option is redundant and can be dropped without changing resolution behavior.
2026-08-20 20:03:40 +08:00
Libin YANG fd136f79f8 chore(deps): bump wrangler, marked, and related packages (#1919) 2026-08-18 21:52:26 +08:00
ziven 4892a3d8ec refactor(upload): modularize image upload providers (#1918) 2026-08-18 19:29:17 +08:00
Libin YANG 435c7d132b chore(deps): bump CodeMirror, vue-tsc, and workers-types (#1915) 2026-08-16 21:17:57 +08:00
Libin YANG 9abab6a020 fix(web): keep Mermaid diagrams intact when copying to WeChat (#1914)
Sanitize juice-invalid CSS, flatten foreignObject labels, separate overlapping state edge labels, and drop extra journey preview height.
2026-08-16 09:57:42 +08:00
Libin YANG 236f2f12a9 chore(deps): bump packages and migrate CI to pnpm/setup (#1911) 2026-08-15 08:52:58 +08:00
Libin YANG 761b4f4b42 chore(deps): bump wrangler, vscode types, and related packages (#1910)
Align @types/vscode and engines.vscode at 1.125.0 so vsce packaging
stays valid. Bump wrangler to ^4.122.0 so @cloudflare/vite-plugin
1.52.0 can land after the npmmirror lag that blocked 1.51.2.
2026-08-13 19:55:54 +08:00
Libin YANG 130f8d5d43 chore(deps): bump aws-sdk, reka-ui, tsx, and cloudflare packages (#1905) 2026-08-11 08:50:34 +08:00
Libin YANG 879186d1a3 chore(deps): replace deprecated crypto-js with crypto-es (#1903) 2026-08-10 09:39:32 +08:00
Libin YANG 8fcda70cc3 chore(deps): bump @lucide/vue and @cloudflare/workers-types (#1902) 2026-08-10 08:58:03 +08:00
Libin YANG 4699016755 chore(deps): upgrade dependencies (#1900)
Bump outdated deps within existing semver ranges and catalog:
@aws-sdk/client-s3 and s3-request-presigner 3.1106.0,
@cloudflare/vite-plugin 1.51.1, @cloudflare/workers-types 5.20260808.1,
@lucide/vue 1.30.0, @types/node 26.2.0, @antfu/eslint-config 9.3.0,
eslint 10.8.1, hono 4.13.1, isomorphic-dompurify 3.22.0, tsx 4.23.11,
vite 8.2.1, wrangler 4.120.0.

Kept: prettier 2.8.8 (pinned), typescript ~6.0.3 (TS 7 major deferred),
@types/vscode 1.120.0 (must not exceed engines.vscode), crypto-js
(deprecated, no successor). Patched deps unchanged; patch files still apply.
2026-08-09 20:08:57 +08:00
Libin YANG 4aaa1ee278 perf(web): editor rendering & storage performance, fix history preview overflow (#1898)
- Group posts by parent id once instead of re-filtering per tree node
- Collect headings during render instead of parsing the output HTML
- Debounce reactive persistence behind an in-memory overlay so sync
  reads stay current; snapshot pending writes to localStorage on
  pagehide and restore them on next launch so no state is lost
- Skip off-screen rendering via content-visibility for the post tree,
  search results, and diff lines
- Preload the post-slider chunk when idle; pre-bundle diff-match-patch
  so the dev server stops force-reloading on first interaction
2026-08-07 17:15:48 +08:00
Libin YANGandCursor 6ca214b7c3 fix(web): editor search & persistence fixes, keyboard a11y, cleanups (#1896)
* fix(web): fix post search misses and history restore timestamp

- extract search logic to lib/search-posts with a 250ms debounce; count matches via String.match (avoids stale-lastIndex misses of a reused global RegExp across posts) in a single scan for results and totals together
- render search results and history version entries as real buttons; make the history list width responsive on narrow screens
- bump post.updateDatetime on history restore so restored content is picked up by update-time sorting and cloud sync

Co-authored-by: Cursor <cursoragent@cursor.com>

* perf(web): replace deep post watches with signature watchers

- watch per-post signatures (id/title/content length/updateDatetime ms/parent/history length/collapsed) instead of deep-traversing every post on each editor commit; the old deep watch compared identical object identities and never persisted edits
- collect dirty post ids in a set and flush once per debounce window, so rapid edits across different posts are all saved (shared single-argument debounce used to drop earlier posts)
- inject heading anchor ids during render instead of assigning output twice, avoiding a second preview DOM rebuild

Co-authored-by: Cursor <cursoragent@cursor.com>

* refactor: dedupe escapeHtml/delay helpers and remove dead code

- share one escapeHtml in apps/api share pages and reuse @md/core's in the formula dialog
- centralize the delay() helper used by preview boot, PNG export and the editor header
- drop unused createTable/checkImage utilities and a stale debug comment

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(web): improve keyboard accessibility across editor UI

- make drag-drop upload areas, syntax help cards, JSON preview expanders and the footer line/col indicator keyboard-operable (real buttons or role/tabindex + Enter/Space)
- reveal hover-only controls (post item menu, table cell delete buttons) on keyboard focus via focus-visible
- add missing aria-labels to icon-only buttons, role=tablist to the CSS editor tabs, role=checkbox to multi-select, and move the collapse toggle out of the post row button to avoid nested interactives

Co-authored-by: Cursor <cursoragent@cursor.com>

* test(core): add render tests for footnote, toc, ruby, markup, slider and alert extensions

Co-authored-by: Cursor <cursoragent@cursor.com>

* ci: unify web type-check with build and include @md/shared in tests

- run the package's own vue-tsc --build --force for type-check:web so CI catches the same errors as pnpm web build
- add @md/shared tests to the root test script

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(ci): commit generated auto-import/components dts for type-check job

vue-tsc --build --force builds the referenced tsconfig.app.json, which includes auto-imports.d.ts and components.d.ts. Both were gitignored, so the CI type-check job (no prior vite build to regenerate them) failed with TS2304 for every auto-imported global (ref, useDark, useToggle, ...).

The previous vue-tsc --noEmit ran on the solution-style root tsconfig (files: [] + references) and checked zero files, which is why CI was green while real errors slipped through.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(web): guard zero-width search matches and clean up a11y semantics

- ignore zero-width regex matches when counting, highlighting and snippeting so empty-matching patterns (a*, ^, \b) neither match every post nor inflate counts to O(content length); replace skips zero-width positions and inserts the replacement literally
- give the multi-select checkbox an accessible name (new common.selectPost message)
- move the CSS tab more-actions button out of the role=tab element so each tab is a single focus stop

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-07 14:25:03 +08:00
Libin YANGandCursor 91dadd4ddd fix(web): guard drag-drop binding against stale template ref on HMR remount
The async onMounted callback can resolve after an HMR remount, where
codeMirrorWrapper of the stale instance is already null.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-07 10:42:00 +08:00
Libin YANGandCursor fa8eb20a33 fix(web): defer panel resize to rAF and skip no-ops
nextTick still runs inside Vue's update flush, where resize() ->
setLayout re-queues SplitterGroup's own update and Vue aborts with
'Maximum recursive updates exceeded'. rAF runs after paint when the
group layout has settled; the getSize guard prevents no-op resizes
from starting a constraint cascade.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-07 10:32:52 +08:00
Libin YANG 64573a9a31 feat(web): add visual table editor dialog (#1895)
- create and edit GFM tables in a dialog with row/column steppers,
  per-column alignment cycling, and cell keyboard navigation
- open in edit mode from the editor context menu (position-aware via
  posAtCoords), the insert dropdown, slash command, and command palette
- click a table in the preview to edit it, mapped positionally through
  a marked-parity scanner (fence/blockquote/indentation aware)
- preserve original indentation on update, re-locate tables safely when
  the document changed while the dialog is open, and swallow surplus
  blank lines on delete
- guard ResizablePanel.resize() calls against reka-ui mount races
2026-08-07 10:24:58 +08:00
Libin YANGandCursor c975279c6f build(deps): fix hono ReDoS alert, bump aws-sdk and workflow pnpm (#1894)
* build(deps): fix hono ReDoS via override and bump aws-sdk

- Override hono to ^4.13.0: @modelcontextprotocol/sdk pins 4.12.33,
  which is vulnerable to ReDoS in the CORS middleware
  (CVE-2026-69207 / GHSA-8j4g-w8fx-2239, dependabot alert #317)
- Bump @aws-sdk/client-s3 and @aws-sdk/s3-request-presigner to 3.1104.0

Co-authored-by: Cursor <cursoragent@cursor.com>

* ci: bump pnpm from 11.18.0 to 11.20.0 in workflows

All actions were verified against upstream and are already on their
latest major versions (checkout v7, setup-node v7, wrangler-action v4,
github-script v9, stale v11, upload-artifact v7, etc.).

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-06 08:58:24 +08:00