Repository navigation
Start .PD 0 on a new line for man line breaks - #671
Merged
Merged
Conversation
In src/man.c, CMARK_NODE_LINEBREAK and CMARK_NODE_SOFTBREAK under CMARK_OPT_HARDBREAKS emit `.PD 0\n.P\n.PD` without a leading CR(). When text precedes the break, `.PD 0` is appended to that line (e.g. `foo.PD 0`), so roff renders it as literal text and `.P` leaves a full paragraph gap instead of a zero-spaced line break. Call CR() before emitting `.PD 0\n.P\n.PD` in both branches, matching every other macro in src/man.c, and add regression tests in api_test/main.c.
Member
|
Good, thanks. |
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.
In
cmark -t man, hard line breaks and--hardbreakssoft breaks write.PD 0\n.P\n.PDwithout a leading newline:Because
.PD 0isn't on its own line, groff prints it as literal text (foo.PD 0). That also stops.PD 0from running, so.Pleaves a full paragraph gap beforebar.I added
CR()beforeLIT(".PD 0\n.P\n.PD")in bothCMARK_NODE_LINEBREAKand theCMARK_OPT_HARDBREAKSbranch, which matches every other macro insrc/man.c. Withgroff -man -Tutf8andman -l,fooandbarnow sit on adjacent lines with no stray.PD 0.I added five regression cases to
render_maninapi_test/main.cfor hard breaks,--hardbreaks(with and without--nobreaks), wrapping, and consecutive breaks. All five fail onmasterand pass with the fix.