docs: Break lines at meaning boundaries - #2903
Conversation
|
This is how benchmark results would change (along with a 95% confidence interval in relative change) if 308cf79 is merged into claude/badge-harmonization:
|
|
This is how benchmark results would change (along with a 95% confidence interval in relative change) if 9bb18cf is merged into claude/badge-harmonization:
|
|
This is how benchmark results would change (along with a 95% confidence interval in relative change) if 4b46f7b is merged into claude/badge-harmonization:
|
4b46f7b to
0a0aa9e
Compare
|
This is how benchmark results would change (along with a 95% confidence interval in relative change) if 0a0aa9e is merged into claude/badge-harmonization:
|
0a0aa9e to
1abfa9d
Compare
|
This is how benchmark results would change (along with a 95% confidence interval in relative change) if 1abfa9d is merged into claude/badge-harmonization:
|
1abfa9d to
3b92d5c
Compare
|
This is how benchmark results would change (along with a 95% confidence interval in relative change) if 3b92d5c is merged into claude/badge-harmonization:
|
Reformatting only, no wording changes: prose in README.md, the vignettes and the roxygen and inline comments under R/ now breaks at sentence and clause boundaries rather than wrapping to a fixed width. The payoff is sentence-level diffs. A reworded sentence touches one line instead of reflowing the paragraph around it, so review sees the change and not the rewrap. man/*.Rd is regenerated because roxygen2 passes source line breaks through to the .Rd. The rendered help is byte-identical -- checked with tools::Rd2txt() over every topic -- as is the rendered README. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WWhverMTZZKgEpUuTK117m
Follow-up to the semantic line break pass, reformatting only.
Where a sentence has to be broken across lines,
that sentence and the sentence after it now each start at the beginning of a line,
so a reworded sentence touches its own lines instead of reflowing its neighbours.
Some sentence pairs are separated by two spaces, which `Rd2txt()` renders literally.
Breaking there would drop a space from the rendered help,
so those pairs are joined onto one long line instead of being broken elsewhere.
That is why a few lines now exceed the usual width.
Left alone: citation lists under `@references`, the GPL headers,
the aligned input/output comment in `R/epi.R`,
the `\enumerate{}` block in `R/centrality.R`
whose items render differently depending on whether `\item` is followed by a space or a line break,
and paragraphs where honouring the rule would need a single line of more than 300 characters.
man/*.Rd is regenerated because roxygen2 passes source line breaks through to the .Rd.
The rendered help is byte-identical -- checked with tools::Rd2txt() over all 662 topics.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WWhverMTZZKgEpUuTK117m
The long single-line roxygen paragraphs existed only to protect a sentence
gap: two spaces between sentences that a line break used to swallow, because
commonmark discards the whitespace a break stands for and Rd2txt then rendered
the gap as one space. Joining was the only way to keep it.
The joins come out, including the 26 places the earlier pass had to leave
alone because joining them would have produced lines of 1440 and 973
characters.
The spectrum topic in R/centrality.R keeps its \enumerate{} block as is: its
items are inconsistent, some \item followed by a space and some by a line
break, which Rd2txt renders as one space versus two, so no reflow leaves the
rendering identical.
man/ is left to CI, which regenerates it from these sources.
A line break which follows the end of a sentence currently renders as one space rather than two.
Restoring that gap needs a patched roxygen2, which is a separate decision and a separate pull request,
so it is deliberately not part of this change.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WWhverMTZZKgEpUuTK117m
3b92d5c to
126e3cf
Compare
|
This is how benchmark results would change (along with a 95% confidence interval in relative change) if 126e3cf is merged into claude/badge-harmonization:
|
Reformatting only, no wording changes. Prose in the roxygen and inline comments under
R/, four vignettes andREADME.mdnow breaks at sentence and clause boundaries rather than wrapping to a fixed width — the conventionAGENTS.mdalready asks for ("Use line breaks after each sentence", "Keep each sentence on its own line in roxygen2 comments"). This brings the rest of the package in line with it.This is the largest package in a fleet-wide pass: ~22,000 roxygen lines.
The three commits
How it was done
By script rather than by hand, because hand-editing 22,000 lines cannot be made consistent or reviewable. Each reflowable block is joined and re-split at sentence boundaries, then at clause boundaries — comma, semicolon, colon, else a subordinating conjunction — only where a sentence would exceed 140 columns.
Blocks already conforming are emitted verbatim: 17 of 84 in-scope
R/*.Rfiles come out byte-identical, and within changed files any unit that is already one sentence per line is passed through untouched. The pass is idempotent — re-running it on the result changes nothing.The double-space gap, and the third commit
Two spaces between sentences render literally in
Rd2txt(), and a line break swallows one of them: commonmark discards the whitespace a break stands for. So the first two commits could not break at such a gap, and left 93 single lines of up to 407 columns — including a Bonacich-centrality paragraph and aplot.igraph()paragraph that no break could touch at all.The third commit breaks those 93 lines apart at 99 sentence gaps, plus 15 further clause breaks so nothing it creates exceeds 140 columns. The longest roxygen line in the package drops from 407 to 344 columns, and lines over 140 from 196 to 149.
The patched roxygen2 is a separate pull request
Restoring the gap that a break now swallows needs a patched roxygen2. That is a separate decision, and it is #2906, stacked on top of this chain, so it can be taken or left on its own.
Without it the rendered help moves in exactly one way: where a sentence pair separated by two spaces was split across lines, the gap narrows to a single space.
tools::Rd2txt()over the 633 topics this branch regenerates finds 80 of them differing, and every difference is whitespace and nothing else — inarpack,to be solved. Possible valuesbecomesto be solved. Possible values. Restoring those 80 is what #2906 does.man/is not edited by hand here. CI roxygenises and commits the regenerated.Rdfiles itself, so whichever roxygen2 is installed at that point is what produces them; they arrive on this branch as an automated commit rather than in the hand-written diff.Rebased on current
mainmainmoved under this branch, mostly through #2868 (the dots documentation) and the newconstructor_spec,layout_specandigraph_opttopics. Generated files were resolved by regenerating, never by hand. The nine hand-writtenR/conflicts were all the same shape —mainrewrote a@param \dotsor added a@seealsosentence, this branch reflowed the old text — and were resolved by takingmain's wording and breaking it at sentence boundaries. Each resolved file was checked word-for-word againstmain's version with comment markers stripped and whitespace collapsed, so nothing was reworded, lost or added. The prosemainbrought in is reflowed to the same convention.Verification
R/. Confirmed by filtering the diff.tools::Rd2txt()over all 665 topics, comparing the base of this branch with its tip as documented by the patched roxygen2 of ci: Document with a patched roxygen2 that keeps the sentence gap #2906: 529 topics change, every difference is sentence spacing, and no topic loses a gap.main.README.md— byte-identical before and after.air format .— no further changes.Rscript tools/check-id-casing.R— 0 violations. EveryR/file parses.Pre-existing
man/drift, not from this PRRegenerating on a pristine checkout renames the C-library links in seven topics —
cliques,cluster_leading_eigen,isomorphisms,leading.eigenvector.community,maximal.cliques,simple_cyclesandsubgraph_isomorphisms— dropping the*_callbackC functions the committedman/points at. This branch edits noman/by hand, so it neither introduces nor fixes that, but the drift is real and is someone's to resolve separately. It is the same drift as themotifs_randesu_callback_closure()one, whichmainhas since fixed.Left alone
aaa-*.R,cpp11.R, threeimport-standalone-*.R— and the# BEGIN/END GENERATED ARG_HANDLEregions inside hand-written files.@examples,@usageand other non-prose tags;\preformatted{},\tabular{}, code fences, markdown tables, and the structural indentation of\describe{},\itemize{},\enumerate{}.@references. A.there separates a title from a journal, not two sentences, so six of them keep the gap mid-line.\enumerate{}block in thespectrumtopic. Its items are inconsistent — some\itemfollowed by a space, some by a line break, whichRd2txt()renders as one space versus two — so no reflow leaves the rendering identical.# "lines inR/components.R— typo'd roxygen (# "rather than#') inside a block, not comments.README.md's allcontributors HTML table; only the ~6 prose lines above it changed.r-lib/here#195 is the reference PR for this pass, reviewed by hand before the rest were run.
🤖 Generated with Claude Code
https://claude.ai/code/session_01WWhverMTZZKgEpUuTK117m