feat: authorship + change annotations in the built-in Markdown preview (D3/D21, PUC-3); cowriting.annotations toggle
Task 7 of the native-surfaces migration plan. Pure previewAnnotations.ts (annotateSource + cowritingMarkdownItPlugin) reuses trackChangesModel.ts's sentinel discipline (#33/#47), generalized to a 3-way ins-claude/ins-human/del tag (exported injectSentinels/sentinelsToSpans, colorByAuthor unaffected, 84/84 existing tests pass unmodified). Host hook in extension.ts wires registry/diffView/attribution/proposals/config into the plugin, exposed via CowritingApi.extendMarkdownIt + a previewAnnotationHost test seam. cowriting.annotations setting + toggleAnnotations command/menu. Q4 mermaid (previewScripts + options.highlight fence override) implemented per the proven bierner.markdown-mermaid pattern; intra-diagram diff augmentation scoped out (unverifiable via the structural E2E harness) — see task-7-report.md. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
+21
-2
@@ -45,15 +45,34 @@ const previewOptions = {
|
||||
logLevel: "info",
|
||||
};
|
||||
|
||||
/** @type {import('esbuild').BuildOptions} */
|
||||
const previewMermaidOptions = {
|
||||
entryPoints: ["media/preview-mermaid.ts"],
|
||||
outfile: "out/media/preview-mermaid.js",
|
||||
bundle: true,
|
||||
// Task 7 (Q4): contributed via markdown.previewScripts into the BUILT-IN
|
||||
// preview's webview — same browser/IIFE shape as previewOptions above, and
|
||||
// the same reason mermaid is bundled here (never in the host bundle).
|
||||
platform: "browser",
|
||||
format: "iife",
|
||||
target: "es2020",
|
||||
sourcemap: true,
|
||||
logLevel: "info",
|
||||
};
|
||||
|
||||
if (watch) {
|
||||
const ctx = await context(options);
|
||||
const ctxLive = await context(liveTurnOptions);
|
||||
const ctxPreview = await context(previewOptions);
|
||||
await Promise.all([ctx.watch(), ctxLive.watch(), ctxPreview.watch()]);
|
||||
const ctxPreviewMermaid = await context(previewMermaidOptions);
|
||||
await Promise.all([ctx.watch(), ctxLive.watch(), ctxPreview.watch(), ctxPreviewMermaid.watch()]);
|
||||
console.log("esbuild: watching…");
|
||||
} else {
|
||||
await build(options);
|
||||
await build(liveTurnOptions);
|
||||
await build(previewOptions);
|
||||
console.log("esbuild: build complete → out/extension.cjs + out/liveTurn.mjs + out/media/preview.js");
|
||||
await build(previewMermaidOptions);
|
||||
console.log(
|
||||
"esbuild: build complete → out/extension.cjs + out/liveTurn.mjs + out/media/preview.js + out/media/preview-mermaid.js",
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user