You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Mid-document --- … --- is parsed as front matter and silently dropped (herdr last loses the middle of replies) #162
A --- line in the middle of a document is read as YAML front matter when the next line is not blank and another --- line comes later. Everything between the two lines is dropped from the document view. Agent replies often use --- as a section break, so herdr last loses the middle of the reply without any sign that something is missing.
Claude Code and other Markdown previews show the full text.
Repro
plannotator-tui midrule-repro.md with:
# Title
Intro paragraph.
---**Draft**
This paragraph is not shown.
- neither is this list
---
Closing paragraph.
The view shows "Title", "Intro paragraph." and "Closing paragraph.". Everything from **Draft** to the second --- is missing. If you add a blank line after the first ---, the full document is shown.
Cause
parse_options() in crates/plannotator-tui/src/doc.rs enables Options::ENABLE_YAML_STYLE_METADATA_BLOCKS, and split_blocks drops BlockKind::Metadata. pulldown-cmark 0.13 does not check that a metadata block is at the start of the document. It accepts one at any unindented line where:
the line is ---,
the next line is not blank,
a closing --- (or ...) line comes later.
See scan_metadata_block in scanners.rs and its call site in firstpass.rs.
Possible fix
Treat a metadata block as front matter only when it starts at byte 0 (or after leading blank lines). Two ways to do that:
Enable the option only when the source starts with ---.
Keep a Metadata block only when its range starts at 0, and otherwise re-parse that range as ordinary Markdown with the option off.
parse_options() is also used in cjk_emphasis.rs and decorate/syntax.rs, so it is probably simplest to make the change where the options are built.
Activity
fix(render): front matter only at the top of a file, never in a reply (…