Skip to main content

Module marked_block

Module marked_block 

Source

Functions§

contains_marker_line
True when content carries marker as a whole (trimmed) line — the only form the writers emit. Use instead of content.contains(marker) wherever “this file has the block” is meant.
marker_line_span
Byte span (start, end-exclusive) of the first line whose trimmed content equals marker (GL #1158). Marker detection must be line-based: a prose mention like “(see the <!-- lean-ctx --> block below)” matched the old substring search first, so block surgery deleted everything between the mention and the real end marker — silent user-content loss.
remove_content
remove_from_file
replace_marked_block
Replace the region between start and end markers with replacement (trim-aware newlines). If markers are missing or invalid, returns content unchanged.
upsert