Repository navigation
fix(render): front matter only at the top of a file, never in a reply - #163
Merged
Merged
Conversation
pulldown-cmark takes a metadata block at any unindented `---` line that is followed by text and a later `---`, not only at the start of the document. split_blocks parsed with that option on and dropped every metadata block, so a pair of rules in the middle of a document (common in agent replies) hid everything between them. Front matter is now found once, at byte 0, and the rest of the source is parsed with the option off, so any later `---` is a rule or a setext underline. Block ranges still index the whole source, so anchors and line numbers are unchanged. An agent's message or piped text has no front matter at all: a reply that opens with `---` is content. Files and Workspaces documents keep it. Fixes #162
This was referenced Nov 20, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cause
split_blocks(crates/plannotator-tui/src/doc.rs) parsed withENABLE_YAML_STYLE_METADATA_BLOCKSand dropped everyMetadatablock. pulldown-cmark 0.13 does not require a metadata block to start the document: any unindented---line followed by a non-blank line and a later---counts. So a pair of rules in the middle of a reply hid everything between them.Fix
---and pulldown-cmark must close a metadata block that begins at byte 0. The rest of the source is parsed with the option off, so every later---is a thematic break or a setext underline. Block ranges still index the whole source, so anchors, block hints for top-of-file front matter, and exported line numbers do not move.Provenance::AgentMessage) and piped text (Provenance::Stdin) get no front matter at all: a reply that opens with---is content, as Claude Code and other previews show it. Files and Workspaces documents keep front matter.Open::newuses the newDocument::of(&source); the other callers only open files and keepDocument::parse.cjk_emphasis,decorate/syntax) keepparse_options()unchanged, so they still agree with tui-markdown, which renders each block on its own.Tests
New unit tests in
doc.rs: the reporter's document (failed before the fix), front matter at the top still dropped with a later rule pair kept and ranges unchanged, an unclosed---at the top, a blank line after the top---,---as a setext underline, and a message vs. a file with the same text.cargo fmt --check,cargo clippy --locked --workspace --all-targets -- -D warnings(1.96 and 1.99) andcargo test --locked --workspacepass.In the binary (private tmux, scratch
HOMEandPLANNOTATOR_DATA_DIR): the reporter's file showed 3 blocks on main and all 8 with the fix;last --host claude --session <scratch transcript>with a reply that opens with---showed only its last paragraph on main and the whole reply with the fix. A file with real front matter gives the same--blocksoutput before and after.Fixes #162