Repository navigation
fix: preserve custom reST field markers and link-body spacing - #396
Merged
Merged
Conversation
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 #279.
Custom reStructuredText fields such as
:calls:are not in the Sphinx field-name list, so wrapping can move their continuation lines to the field's own indentation and break the field/link structure.Recognize extensible reST field markers at the start of a line, using the field-marker grammar rather than adding a
callsexception. Keep the existing permissive Sphinx recognition for compatibility. Use only the marker span when wrapping, and keep a separating space before inline-link bodies as required by reST. Update the corresponding requirements-table entry; empty bodies still receive no trailing space.Leave the existing list/code classifier unchanged so custom fields with complex bodies retain their previous protection. Add 24 cases covering custom/typed/Unicode/escaped-colon markers, prose and roles, long-link continuation indentation and idempotence, and module-level bullet/enumerated/doctest bodies.
Validation on macOS arm64:
Sphinx 6.2.1 (locked version) generates HTML on both base and branch, but strict
-Wbuilds both fail on the existing missing_staticdirectory warning. That unrelated configuration is unchanged. Linux, Windows and other Python versions were not run locally.--force-wrapretains its documented flattening behavior. An independent module-level long-URI case has the same existing limitation on base and branch; this patch does not claim to repair that separate path.