Conversation
No caller ever passes a non-nil `markup` to any formatter constructor — every formatter creates its own `RDoc::Markup.new` internally. Remove the `markup` parameter from `Formatter#initialize` and all subclasses: `ToHtml`, `ToHtmlCrossref`, `ToHtmlSnippet`, `ToRdoc`, `ToLabel`, `ToTtOnly`, `ToAnsi`, `ToBs`, `ToMarkdown`. Also remove the dead `markup` variable in `Heading.to_html` that was configured with crossref regexp handling but never passed to the formatter.
Collaborator
|
🚀 Preview deployment available at: https://fe8cd161.rdoc-6cd.pages.dev (commit: 7c47d0a) |
tompng
reviewed
Feb 22, 2026
`Formatter#initialize` took an `RDoc::Options` object, but only 2 subclasses (`ToHtml`, `ToHtmlCrossref`) read from it — using just 6 specific boolean/array values. All other formatters passed `nil`. Replace the `options` parameter with explicit keyword arguments: - `ToHtml`: `pipe:`, `output_decoration:` - `ToHtmlCrossref`: `pipe:`, `output_decoration:`, `hyperlink_all:`, `show_hash:`, `autolink_excluded_words:`, `warn_missing_rdoc_ref:` Call sites (`Generator::Markup#formatter`, `RDoc::RDoc#handle_pipe`) now unpack the needed values from `RDoc::Options` at the boundary. `ToHtmlSnippet` and `Text#snippet` no longer receive or forward options. Delete `LinkLabelToHtml` (zero callers in the codebase). Update `CodeObject#options` comment to reflect remaining callers.
7c05c1f to
7c47d0a
Compare
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.
markupparam is never actually used. So let's drop itOptionobjects, formatters should just take the relevant option values. This will unlock further refactors to decoupleCodeObjectandStorelater.