Skip to content

docs: Break lines at meaning boundaries - #104

Open
krlmlr wants to merge 6 commits into
claude/badge-harmonizationfrom
claude/sembr
Open

krlmlr wants to merge 6 commits into
claude/badge-harmonizationfrom
claude/sembr

Conversation

@krlmlr

@krlmlr krlmlr commented Sep 13, 2026

Copy link
Copy Markdown
Owner

Reformatting only, no wording changes. Prose in README.Rmd, vignettes/mockr.Rmd, 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.

The generation notice at the top of README.Rmd was itself wrapped to a fixed width, so two of its sentences started mid-line. It now carries one sentence per line, keeping the five-space continuation indent, matching the form DBI, dm, igraphdata and wrswoR already have. The notice is copied into the rendered files, so README.md and index.md are re-rendered along with it; the wording is word-for-word unchanged.

Verification

man/ is not edited by hand here. roxygen2 passes source line breaks straight through to the .Rd, and the regenerated files are generated output: CI roxygenises and commits them itself, so they arrive on this branch as an automated commit rather than in the hand-written diff. The rendered help does move, in exactly one way: where a two-space sentence gap was split across lines it narrows to one space. tools::Rd2txt() over the 2 topics whose .Rd changed puts 1 of them in that position — in local_mock.Rd, evaluated. Everything becomes evaluated. Everything. Restoring that gap is what the patched roxygen2 further up the stack does. render_readme() run twice produced byte-identical output.

One paragraph deliberately left unreflowed

R/with-mock.R has a paragraph whose sentences are separated by a double space, and Rd2txt() renders that double space literally. roxygen2 strips leading and trailing whitespace from source lines, so breaking at that sentence boundary collapses the gap to a single space — which changes the rendered help.

Both workarounds were tried (a leading space on the continuation, a trailing space on the first line) and both failed the check, so the paragraph keeps its original wrapping rather than the check being weakened to accommodate it. The third sentence of that paragraph, which has no double space before it, was reflowed normally.

This turns out to affect several packages in the fleet, so it is worth knowing as a general limit rather than a quirk here: wherever the source double-spaces between sentences, that gap is content, and the sentence-per-line rule cannot apply without altering the rendered output.

One consequence is worth stating plainly. A line break which follows the end of a sentence currently renders as one space, not two, so writing one sentence per line drops the sentence gap from the rendered help. Restoring it needs a patched roxygen2, which is a separate decision: it is #106, stacked on top of this chain, and can be taken or left on its own. Without it this change simply renders as the package renders today.

Part of a fleet-wide pass. r-lib/here#195 is the reference PR, reviewed by hand before the rest were run.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WWhverMTZZKgEpUuTK117m

krlmlr and others added 6 commits September 14, 2026 05:48
Reformatting only, no wording changes: prose in README.Rmd, 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
A sentence that spans more than one line now starts a line, and so does
the sentence after it. Where the two sentences are separated by the
double space that Rd2txt() renders literally, the pair stays on one long
line: breaking there would drop a space from the rendered help, and a
long line is the lesser evil.

The header comment in README.Rmd was wrapped to a fixed width, so two of its sentences started mid-line.
It now matches the form the rest of the fleet carries, and README.md and index.md are re-rendered from it.

Line breaks only, no wording changes. The rendered help is
byte-identical, checked with tools::Rd2txt() over every topic.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WWhverMTZZKgEpUuTK117m
Continuation lines in roxygen paragraphs now carry two spaces after the
comment marker instead of one, and the first line of a paragraph carries
exactly one, so the source shows at a glance where a paragraph starts and
where it merely continues.

The rendered help is unchanged: these packages enable markdown in roxygen2,
which strips leading whitespace from continuation lines before the .Rd is
written. The joined lines the previous pass produced therefore have to stay
joined -- breaking them would drop a space from the rendered sentence gap.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WWhverMTZZKgEpUuTK117m
The two-space continuation indent never reached the `.Rd`:
this package sets `Roxygen: list(markdown = TRUE)`,
and commonmark strips the leading whitespace of a continuation line before the help page is written.

The sentence gap now comes from roxygen2 itself,
which indents the line break at the point where the break is emitted,
so the source-level indent is redundant.

`man/` is unaffected either way.
Reverting rather than substituting also restores the paragraph and tag alignment that the indent pass changed along the way.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WWhverMTZZKgEpUuTK117m
Several roxygen blocks carried two or three sentences on one very long line.
They were joined on purpose:
a line break between two sentences used to drop the second of the two spaces that separate them,
because commonmark discards the whitespace a line break stands for.
Keeping the sentences on one line was the only way to keep the gap.

A patched roxygen2 indents the line break that follows a sentence,
so a sentence can start its own line and still keep the gap before it.
The joins are no longer needed, and they come out:
every sentence starts a line again, and long sentences break at clause boundaries.

Reformatting only, no wording changes.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants