Repository navigation
Fix hard wrapping of long headings - #448
Open
ryanchou1994 wants to merge 1 commit into
Open
ryanchou1994 wants to merge 1 commit into
ryanchou1994 wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Long headings are passed through the paragraph wrapper, so everything after the first wrapped line becomes ordinary text in the generated Markdown. For example,
<h1>A long heading with several words</h1>should keep its whole title after#, even whenbody_widthis small.Skip wrapping ATX heading lines, including headings inside blockquotes. The matcher uses ASCII spaces and tabs so ordinary text containing non-breaking spaces keeps its existing wrapping behavior. Paragraphs, hashtags, and lines with seven
#characters still wrap normally.The regression fixture exercises the class, convenience function, and actual CLI, including emphasis and inline links in headings. Additional tests cover h1–h6, quoted headings, wrapping disabled, and three Unicode-whitespace controls. This change addresses wrapping added by
body_width; it does not change explicit line breaks already present inside a heading or implement a full Markdown parser.Validation: 241 tests each on macOS (Python 3.13.13) and Linux (Python 3.13.15), plus Black, Flake8, isort, strict mypy 1.19.1 (Python 3.9 target), wheel/sdist builds and Twine checks. The installed Linux wheel passed 12 API/CLI checks outside the checkout. The existing generator-parametrization warnings from pytest remain. One existing expression in the touched config file was reformatted by Black 26.5.1.
Fixes #424