Repository navigation
fix(md): keep the first-line indentation of code blocks - #4487
Merged
PeterStaar-IBM merged 1 commit intoOct 2, 2026
Merged
Conversation
Signed-off-by: Ankit Kumar <ankitkumar19473@gmail.com>
Contributor
|
✅ DCO Check Passed Thanks @ankit2235, all your commits are properly signed off. 🎉 |
Contributor
Merge Protections🟢 Merge protection satisfied — ready to merge. Show 1 satisfied protection🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This was referenced Oct 2, 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.
The Markdown backend called
.strip()on code block content, which removed the leading indentation of the first line while later lines kept theirs. The relative indentation changed, so the code itself was altered: an indented YAML snippet changed structure, and an indented Python snippet no longer parsed.This trims only blank lines before the code and whitespace after it (
lstrip("\n").rstrip()), keeping the first line's indentation. It is the same trimming PR #3891 applies to HTML<pre>. Code blocks whose first line is not indented are unchanged, and whitespace-only blocks are still skipped.The new test covers a fenced block, an indented (non-fenced) block, and a fenced block that starts with a blank line (which is still dropped). It fails on
mainand passes with this change. All existing Markdown groundtruth tests pass unchanged.Issue resolved by this Pull Request:
Resolves #4485
Checklist: