mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-20 12:23:22 +00:00
Each reader in internal/utils found the --- delimiters with its own loop, under four different rules that were only visible by reading all of them, and the list reader existed twice with a path copy and a bytes copy that had drifted apart. A fix to one reader, like the mcp serve fixes to the strict one, did not reach the others, and nobody could say which rule an entry point followed without tracing it. locateFrontmatter now does the locating for every reader, and the rule is a frontmatterPolicy value: strictBlock, lenientBlock, bodyBlock and rewriteBlock name the rules that exist and the entry points that use them. The rules themselves are not unified; every entry point returns what it returned before, including the bufio.Scanner quirks of the readers that take a path (a line of 64 KiB or more ends the content, one \r is dropped per line), which now live in scannable. The strict reader still walks only to the closing delimiter and copies nothing. Two more cases found by comparing old and new code on random input are pinned: a block scalar on the last frontmatter line, and \r\r\n endings. Refs #449