Skip to content

[DOC] Fix the helper methods link on docs.ruby-lang.org - #228

Open
kou wants to merge 1 commit into
ruby:masterfrom
kou:doc-page-dir
Open

kou wants to merge 1 commit into
ruby:masterfrom
kou:doc-page-dir

Conversation

@kou

@kou kou commented Nov 25, 2026

Copy link
Copy Markdown
Member

Fix GH-226

ruby/ruby uses page_dir: doc for RDoc but we don't. So the page for doc/strscan/helper_methods.md is generated as
strscan/helper_methods_md.html in ruby/ruby and as doc/strscan/helper_methods_md.html in ruby/strscan. A relative link can't work in both: doc/strscan/helper_methods.md is broken on docs.ruby-lang.org and helper_methods.md/strscan/helper_methods.md are broken in ruby/strscan. See also GH-179 and GH-198.

Use page_dir: doc in ruby/strscan too so that the same link, strscan/helper_methods.md, works in both.

page_dir adds doc to the RDoc targets. Then the default target, ., isn't used. So the rdoc task specifies . explicitly. Use rdoc . instead of rdoc when you run rdoc directly.

gem install doesn't read .rdoc_options. So --page-dir=doc is also added to rdoc_options in the gemspec. Note that RDoc 6.10.0 or earlier ignores it on gem install. So the link in the documents generated on gem install is broken with old RDoc. RDoc 6.14.0 or later works.

Reported by Burdette Lamar. Thanks!!!

Fix rubyGH-226

ruby/ruby uses `page_dir: doc` for RDoc but we don't. So the page for
`doc/strscan/helper_methods.md` is generated as
`strscan/helper_methods_md.html` in ruby/ruby and as
`doc/strscan/helper_methods_md.html` in ruby/strscan. A relative link
can't work in both: `doc/strscan/helper_methods.md` is broken on
docs.ruby-lang.org and `helper_methods.md`/`strscan/helper_methods.md`
are broken in ruby/strscan. See also rubyGH-179 and rubyGH-198.

Use `page_dir: doc` in ruby/strscan too so that the same link,
`strscan/helper_methods.md`, works in both.

`page_dir` adds `doc` to the RDoc targets. Then the default target,
`.`, isn't used. So the `rdoc` task specifies `.` explicitly. Use
`rdoc .` instead of `rdoc` when you run `rdoc` directly.

`gem install` doesn't read `.rdoc_options`. So `--page-dir=doc` is
also added to `rdoc_options` in the gemspec. Note that RDoc 6.10.0 or
earlier ignores it on `gem install`. So the link in the documents
generated on `gem install` is broken with old RDoc. RDoc 6.14.0 or
later works.

Reported by Burdette Lamar. Thanks!!!

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 25, 2026 00:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified for the documentation layout and helper-methods link changes.

No open issues 🎉

What changed in this PR

Aligns StringScanner’s RDoc page layout with Ruby core so the helper-methods link works in both standalone documentation and docs.ruby-lang.org.

Changes:

  • Sets doc as the page directory for checkout builds and gem-install documentation with compatible RDoc versions.
  • Updates the helper-methods link to use the shared page path.
  • Explicitly includes the repository root in the RDoc task to preserve source discovery.
File Description
strscan.gemspec Adds --page-dir=doc for install-time documentation.
Rakefile Keeps the repository root among RDoc’s input targets.
ext/​strscan/​strscan.c Updates the helper-methods documentation link.
.rdoc_options Sets doc as the documentation page directory.

Review effort: Balanced

This branch has not been deployed

No deployments
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.

Broken link

2 participants