Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand rdoc-ref targets at the end of ri output #1141

Merged
merged 1 commit into from
Dec 9, 2024
Merged

Expand rdoc-ref targets at the end of ri output #1141

merged 1 commit into from
Dec 9, 2024

Conversation

st0012
Copy link
Member

@st0012 st0012 commented Jul 15, 2024

There have been several document refactors in ruby/ruby that extract individual methods/classes' documentation into separate files, like ruby/ruby#6567

Because RI is not capable of rendering those references, RI users are left with dramatically fewer documentation on those methods/classes.

This commit adds a new option --expand-ref (default: true) to expand all the rdoc-ref targets at the end of the output.

Closes #1097

@adam12
Copy link
Contributor

adam12 commented Jul 15, 2024

Tested this on a few core/stdlib methods and it worked well! 👍

@adam12
Copy link
Contributor

adam12 commented Jul 30, 2024

One issue that's not directly related but should be worth noting is it fails to work on [#module-JSON-label-Parsing+Options].

I know it doesn't start with rdoc-ref but it appears to be a valid reference at least on the HTML generated site.

(the example is from JSON.parse, by the way).

@zenspider
Copy link
Member

Might be valid... but it might need to be changed just to fit this PR. Frankly I don't care as long as ri Array#pack works... But I do agree that xrefs for options NEED to be expanded sooner or later. Getting doco that says **opts and then has a broken xref you can't actually use isn't helping ANYONE.

@st0012 st0012 added this to the v6.8.0 milestone Oct 17, 2024
@st0012 st0012 requested a review from colby-swandale October 17, 2024 10:02
@st0012 st0012 modified the milestones: v6.8.0, v7.0.0 Nov 13, 2024
@eregon
Copy link
Member

eregon commented Dec 4, 2024

Would it be possible to expand the references inline like detailed in #1097 (comment) ? That would make ri usable again for such cases and be very similar to what used to be before these extractions.
(If not, let's merge this, it's clearly better than current state)

@st0012
Copy link
Member Author

st0012 commented Dec 9, 2024

@eregon My understanding is that many of the extracted pages are much longer than the original segments. For example, Array#pack before extraction is much shorter than the extracted packed data page. So expanding links inline does not necessarily "restore" the previous experience. IMO, it will give a much worse experience if users suddenly encountered this expanded content when they scroll through the documentation of Array, for example.

@st0012 st0012 self-assigned this Dec 9, 2024
@eregon
Copy link
Member

eregon commented Dec 9, 2024

It's a good point. Since I never saw that expanded document with ri I forgot what it looks like.
IMO https://docs.ruby-lang.org/en/master/packed_data_rdoc.html is near unusable, no matter where or in what format, because it's so long it's very hard to find the relevant directive, to see the overall structure, or to compare to related directives to find the right one (e.g. hard to compare all the integer directives).
I think https://docs.ruby-lang.org/en/3.1/Array.html#method-i-pack is much better, it's a concise table I would think anyone who already used Array#pack once would find more useful than a long explanation for every directive.
So maybe we should change Array#pack docs to be like https://docs.ruby-lang.org/en/3.1/Array.html#method-i-pack and maybe also include a link to the Packed Data document?

Or the Packed Data document should have a summary table similar to https://docs.ruby-lang.org/en/3.1/Array.html#method-i-pack at the top, that could be a good compromise I think.
Then that document would have both the concise/quickly-useful summary table and the longer explanations if the reader wants more details.

In that context of very long references, I agree, expanding the rdoc-ref at the end is probably better indeed.

Copy link
Member

@eregon eregon left a comment

Choose a reason for hiding this comment

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

LGTM

Verified

This commit was signed with the committer’s verified signature.
danielroe Daniel Roe
There have been several document refactors in ruby/ruby that extract
individual methods/classes' documentation into separate files, like
ruby/ruby#6567

Because RI is not capable of rendering those references, RI users
are left with dramatically fewer documentation on those methods/classes.

This commit adds a new option `--expand-ref` (default: true) to expand
all the rdoc-ref targets at the end of the output.
@st0012 st0012 removed this from the v7.0.0 milestone Dec 9, 2024
@st0012 st0012 merged commit 9e2b28c into master Dec 9, 2024
43 checks passed
@st0012 st0012 deleted the fix-#1097 branch December 9, 2024 17:21
matzbot pushed a commit to ruby/ruby that referenced this pull request Dec 9, 2024

Verified

This commit was signed with the committer’s verified signature.
danielroe Daniel Roe
(ruby/rdoc#1141)

There have been several document refactors in ruby/ruby that extract
individual methods/classes' documentation into separate files, like
#6567

Because RI is not capable of rendering those references, RI users
are left with dramatically fewer documentation on those methods/classes.

This commit adds a new option `--expand-ref` (default: true) to expand
all the rdoc-ref targets at the end of the output.

ruby/rdoc@9e2b28c6e3
@st0012
Copy link
Member Author

st0012 commented Dec 14, 2024

@adam12 @zenspider @eregon I've released this feature in RDoc 6.9.0. Can you give it a try to see if there's any issue?

@eregon
Copy link
Member

eregon commented Dec 14, 2024

This seems to work nicely, thanks!

@eregon
Copy link
Member

eregon commented Dec 14, 2024

Ref: PR to add back the concise table for pack/unpack docs: ruby/ruby#12349

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

PLEASE make cross references actually work w/ ri
4 participants