F10 SLICE-3: remove superseded public renderAuthorship (salvaged into colorByAuthor) (#29)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -367,39 +367,6 @@ export function colorByAuthor(
|
||||
return sentinelsToSpans(render(injected));
|
||||
}
|
||||
|
||||
/**
|
||||
* Pure authorship render (INV-26/28): the CURRENT text with each F3-attributed
|
||||
* span colored by author. Prose blocks get inline `<span class="cw-by-*">`;
|
||||
* code/mermaid fences stay ATOMIC (INV-27) — an overlapping span yields a
|
||||
* block-level author badge, never inner sentinels. Deterministic.
|
||||
*/
|
||||
export function renderAuthorship(
|
||||
currentText: string,
|
||||
spans: AuthorSpan[],
|
||||
opts: RenderOptions = {},
|
||||
): string {
|
||||
const render = opts.render ?? defaultRender;
|
||||
const safe = (src: string): string => {
|
||||
try {
|
||||
return render(src);
|
||||
} catch (err) {
|
||||
return chip(err instanceof Error ? err.message : String(err));
|
||||
}
|
||||
};
|
||||
return splitBlocksWithRanges(currentText)
|
||||
.map((b) => {
|
||||
const overlapping = spans.filter((s) => s.end > b.start && s.start < b.end);
|
||||
if (b.type !== "prose") {
|
||||
const badge = authorBadge(new Set(overlapping.map((s) => s.author)));
|
||||
const inner = safe(b.raw);
|
||||
if (!badge) return `<div class="cw-blk">${inner}</div>`;
|
||||
return `<div class="cw-blk ${badge.cls}"><span class="cw-badge">${badge.label}</span>${inner}</div>`;
|
||||
}
|
||||
return `<div class="cw-blk">${colorByAuthor(b.raw, b.start, overlapping, safe)}</div>`;
|
||||
})
|
||||
.join("\n");
|
||||
}
|
||||
|
||||
/** Off-state body: the current buffer as plain markdown, no annotations (INV-33). */
|
||||
export function renderPlain(currentText: string, opts: RenderOptions = {}): string {
|
||||
const render = opts.render ?? defaultRender;
|
||||
|
||||
Reference in New Issue
Block a user