refactor: replace command link interception with :cmd[] directive

Replace the previous mechanism of intercepting specific command-prefixed
anchor tags with a dedicated `:cmd[]` markdown directive.

- Implement `cmdDirective` for `marked-directive` support.
- Update `CommandLinkManager` to listen for clicks on `[data-cmd]` spans
  instead of parsing `href` attributes.
- Add CSS styles for the new `.cmd-link` class.
This commit is contained in:
2026-07-12 14:05:07 +08:00
parent 182d7ff28d
commit 42e8971ff7
4 changed files with 69 additions and 50 deletions
+2
View File
@@ -7,6 +7,7 @@ import { gfmHeadingId } from "marked-gfm-heading-id";
import markedColumns from "./columns";
import markedCodeBlockYamlTag from "./code-block-yaml-tag";
import { iconDirective, setIconBase } from "./icon";
import { cmdDirective } from "./cmd";
// 使用 marked-directive 来支持指令语法
const marked = new Marked()
@@ -27,6 +28,7 @@ const marked = new Marked()
level: "container",
},
iconDirective,
cmdDirective,
]),
{
extensions: [...markedColumns()],