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:
1 parent
4636649576
commit
a1597697e5
19 files changed
+3870
No files matched your search
@@ -0,0 +1,11 @@
|
||||
// M0 原型入口:只挂载编辑器,M1 替换为 Vue 外壳
|
||||
import { createEditor } from './editor'
|
||||
import sample from './demo/sample.md?raw'
|
||||
import './themes/base.css'
|
||||
|
||||
// ?repeat=N 将示例重复 N 次,用于大文档性能测试
|
||||
const repeat = Number(new URLSearchParams(location.search).get('repeat') ?? 1)
|
||||
const doc = Array.from({ length: Math.max(1, repeat) }, () => sample).join('\n')
|
||||
|
||||
const view = createEditor({ parent: document.getElementById('app')!, doc })
|
||||
;(window as unknown as { rawmarkView: typeof view }).rawmarkView = view
|
||||
Reference in new issue
Block a user