feat(core): markdown live preview #2#122
Open
arieslx wants to merge 3 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary / 摘要
Sanitize source-mapped Markdown HTML export and reuse it in the Electron split preview to avoid raw HTML injection.
Motivation / 背景与动机
Split preview previously had a separate Markdown preview renderer path that could inject raw Markdown HTML into the Electron renderer. This change routes split preview rendering through core HTML export and applies the same sanitizer boundary to source-mapped and non-source-mapped export paths.
Changes / 变更内容
packages/core:html-export.tsfor source-mapped semantic HTML export withdata-source-*attributes.html-sanitizer.tsto remove dangerous raw HTML tags/attributes and allowlist URL protocols.exportHTML()andexportHTML({ sourceMap: true }).ExportHTMLOptions,ExportHTMLResult, andExportHTMLSourceMapEntrytypes.parseMarkdownToAstexport.packages/plugin-*:apps/electron-demo:editor.exportHTML({ sourceMap: true }).openspec/:Testing / 测试
pnpm testpasses / 全绿npm test -- --run packages/core/test/editor.test.ts apps/electron-demo/test/split-preview.test.tspnpm build) / 受影响包构建通过npm run build, but pnpm stopped at the electron/esbuild build-script approval gate.parseMarkdownToAstexport compatibility.Compliance / 合规自检
None.
dist/,dist-electron/, compiled.jsfrom.ts) / 未提交构建产物.env/ personal vault data committed / 无敏感信息Checklist / 自检清单
Screenshots / Recordings · 截图或录屏 (UI changes)