opencode / packages /session-ui /src /components /markdown-projection.ts
SaylorTwift's picture
SaylorTwift HF Staff
Add files using upload-large-folder tool
3e05655 verified
Raw
History Blame Contribute Delete
484 Bytes
import type { Block, Projection } from "./markdown-stream"
export function completedProjection(text: string): Projection {
return { text, blocks: [{ raw: text, src: text, mode: "full" }] }
}
export function canReusePendingBlock(current: Pick<Block, "mode" | "raw"> | undefined, next: Block) {
if (!current || current.mode !== next.mode) return false
if (next.mode === "code" || next.mode === "live") return next.raw.startsWith(current.raw)
return current.raw === next.raw
}