feat(web): add M0 live preview editor prototype

- CodeMirror 6 editor with Obsidian/Typora-style live preview: block
  markup revealed per line, inline markup revealed per element
- Fenced code highlighting via Shiki (github-dark, JS regex engine) in a
  Web Worker, languages loaded on demand
- Lezer syntax tree to HTML renderer for share pages, checked against
  the CommonMark 0.31.2 spec (640/652; 12 known parser deviations)
- Use markdownLanguage directly to avoid bundling lang-html/css/js
This commit is contained in:
eezd committed 2026-10-16 17:23:58 +08:00
1 parent 4636649576
commit a1597697e5
19 files changed
+3870

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
// 主线程与高亮 Worker 之间的消息格式
export interface HighlightRequest {
id: number
lang: string
code: string
}
// 扁平数组:[offset, length, color, fontStyle, offset, length, ...],避免大量小对象跨线程拷贝
export type TokenRun = (number | string)[]
export interface HighlightResponse {
id: number
// 语言不受支持时为 null,调用方按纯文本显示
tokens: TokenRun | null
}