Repository navigation
Trim blank lines after the header in CR-only documents - #194
Merged
Merged
Conversation
TrimBody only treated '\n' as a line end, so a CR-only document kept its blank lines after the header: ExtractBody returned "\r\rBody" where LF and CRLF give "Body", and RemoveFrontmatter and ReplaceFrontmatter carried the same stray lines into their output. Treat '\r' as a line end as well; CRLF still lands after its '\n'. Fixes #184 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ho7QngpAmRRAxjmT2qp1sn
The build's ktsu.Sdk sync rewrote it, and it was committed by mistake. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ho7QngpAmRRAxjmT2qp1sn
|
This was referenced Oct 7, 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.



Fixes #184
Before: with CR-only line endings,
ExtractBody("---\rtitle: x\r---\r\r\rBody\r")returned"\r\rBody", andRemoveFrontmatter/ReplaceFrontmatterkept the same blank lines. LF and CRLF documents give"Body".After: all three line endings give the same body.
How:
TrimBodyadvanced past leading blank lines only on'\n'. It now treats'\r'as a line end too. For CRLF it still lands after the'\n'.Tests:
LineEndingTestsgains CR/LF/CRLF cases forExtractBody,RemoveFrontmatterandReplaceFrontmatteron a document with blank lines after the header. The three CR cases fail without the change and pass with it. Full suite: 273 passed.🤖 Generated with Claude Code
https://claude.ai/code/session_01Ho7QngpAmRRAxjmT2qp1sn
Generated by Claude Code