Skip to content

Add nodoc filter to doc type methods#14910

Merged
straight-shoota merged 7 commits intocrystal-lang:masterfrom
spuun:add-nodoc-filter-to-doc-type-methods
Aug 26, 2024
Merged

Add nodoc filter to doc type methods#14910
straight-shoota merged 7 commits intocrystal-lang:masterfrom
spuun:add-nodoc-filter-to-doc-type-methods

Conversation

@spuun
Copy link
Contributor

@spuun spuun commented Aug 15, 2024

The doc generator is creating links to non-documented type. I tried to fix this in #14878, but it turned that it removed links to documented non-top-level types.

Instead, filters will now be applied in Doc::Type#ancestors, Doc::Type#included_modules and Doc::Type#extended_modules instead as it was already done in Doc::Type#subclasses.

Some specs to verify correct(?) behavior has been added.

Example of File.html.

Before:

file_html_before

After:

file_html_after

Fixes #9816, #12018

@straight-shoota
Copy link
Member

I suppose it could be up for debate whether undocumented types should be entirely invisible. But there could be some value in at least mentioning their existence in some places?
grafik

So alternatively we could continue with the approach in #14878, just using must_be_included? as selection criterion instead of in?(types).

@spuun
Copy link
Contributor Author

spuun commented Aug 15, 2024

I suppose it could be up for debate whether undocumented types should be entirely invisible. But there could be some value in at least mentioning their existence in some places?

Hm, I guess. And the inherited methods for undocumented types too, I suppose?

So alternatively we could continue with the approach in #14878, just using must_be_included? as selection criterion instead of in?(types).

Maybe some conditions in _methods_inherited.html whether a text should be a link or not is enough?

@straight-shoota
Copy link
Member

And the inherited methods for undocumented types too, I suppose?

Oh, that's a tricky one.
I guess not? When a method is defined in a nodoc namespace, it should be expected that the method is also supposed to be undocumented.

Maybe this is all fine then. Nodoc ancestors are supposed to be hidden and don't need to be mentioned anywhere in the API docs... 🤷

@straight-shoota straight-shoota added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:tools:docs-generator labels Aug 15, 2024
@Blacksmoke16 Blacksmoke16 linked an issue Aug 15, 2024 that may be closed by this pull request
@straight-shoota straight-shoota added this to the 1.14.0 milestone Aug 25, 2024
@straight-shoota straight-shoota merged commit 791b0e4 into crystal-lang:master Aug 26, 2024
straight-shoota added a commit to straight-shoota/crystal that referenced this pull request Oct 7, 2024
straight-shoota added a commit that referenced this pull request Oct 7, 2024
* Revert "Fix copy-paste-typo in spec describe (#15054)"

This reverts commit 1f6b51d.

* Revert "Add nodoc filter to doc type methods (#14910)"

This reverts commit 791b0e4.
@straight-shoota
Copy link
Member

This change was insufficient due to #15053 and got reverted in #15064

@straight-shoota straight-shoota removed this from the 1.14.0 milestone Oct 7, 2024
@straight-shoota straight-shoota added the status:reverted PR was reverted or reverts another one, and is not part of a milestone label Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind:bug A bug in the code. Does not apply to documentation, specs, etc. status:reverted PR was reverted or reverts another one, and is not part of a milestone topic:tools:docs-generator

Projects

None yet

Development

Successfully merging this pull request may close these issues.

doc link is broken Doc generator creates links to features in excluded namespaces

3 participants