feat(frontmatter): support |/> block scalars#5
Merged
Conversation
The hand-rolled frontmatter parser only understood scalars, flow lists and block lists; a `key: |` value became the literal string "|" and the indented continuation lines were silently dropped. This blocked multi-line values such as an inline bibliography. Add YAML block-scalar support: - `|` literal (newlines preserved) and `>` folded (single breaks -> space, blank lines -> newlines). - Chomping indicators: `-` strip, `+` keep, default clip (one trailing newline). - Common leading indentation is stripped; a value that merely starts with `|`/`>` (e.g. `|pipe`) stays an ordinary scalar. Existing scalar/flow-list/block-list parsing is unchanged. Tests cover literal/folded blocks, all three chomping modes, and the non-block guard. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Jun 3, 2026
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.
Why
The frontmatter parser turned
key: |into the literal string"|"and dropped the indented continuation lines. That blocked multi-line values — notably an inline bibliography.Change
Add YAML block-scalar support to
pytex_protocol/frontmatter.py:|literal (newlines preserved) and>folded (single breaks → space, blank lines → newlines).-strip,+keep, default clip (one trailing newline).|/>(e.g.|pipe) stays an ordinary scalar.Existing scalar / flow-list / block-list parsing unchanged.
→
"@book{knuth,\n author = {Knuth},\n}\n"Verification
New tests for literal/folded blocks, all three chomping modes, the non-block guard, and a body-separation regression. Full suite 701 passed; ruff + mypy --strict clean.
Foundation for the upcoming inline-bibliography frontmatter feature.
🤖 Generated with Claude Code