Expand description
Markdown block segmentation + block-level diff — a faithful port of
block-diff.ts.
Blocks are segmented by a line classifier (fenced code, tables, headings,
blockquotes, lists, block-level HTML, paragraph runs), then diffed with the
same load-bearing LCS tie-break as line_diff (lcs[i+1][j] >= lcs[i][j+1]
⇒ prefer removed). Comparison is over normalized blocks (whitespace
collapsed) while the emitted raw is the un-normalized block from the side
that owns it. html is left empty here and filled later by the orchestrator
via docgen-core::markdown::render_markdown.
Functions§
- build_
block_ diff - Build the full block-level diff stream between two markdown documents. Each
DocDiffBlockhashtml = ""(filled later by the orchestrator). - split_
markdown_ blocks - Split a markdown document into its top-level blocks, preserving fenced-code
and table blocks verbatim. Frontmatter and
<script>blocks are stripped first. - strip_
invisible_ document_ parts - Strip a leading frontmatter block and all
<script>…</script>blocks, then trim. Mirrors the original’s three non-greedy regex replacements.