Skip to content

Add :showdoc: directive for private and protected objects (RFC #0011)#15337

Merged
straight-shoota merged 5 commits intocrystal-lang:masterfrom
nobodywasishere:nobody/add-showdoc-directive
Feb 5, 2025
Merged

Add :showdoc: directive for private and protected objects (RFC #0011)#15337
straight-shoota merged 5 commits intocrystal-lang:masterfrom
nobodywasishere:nobody/add-showdoc-directive

Conversation

@nobodywasishere
Copy link
Contributor

First part of splitting up #15294.

Private class:
image

Private methods:
image
image

@ysbaddaden
Copy link
Collaborator

ysbaddaden commented Jan 13, 2025

I've just been thinking of an edge case: we need the parent namespace to appear if any descendant type is marked with :showdoc: but will any documentation following :nodoc: be shown?

# :nodoc:
# 
# this comment musn't appear in docs
module Foo
  # :showdoc:
  #
  # this comment must appear in docs
  module Bar
  end
end

@straight-shoota
Copy link
Member

@ysbaddaden I believe the nodoc nesting showdoc case should be handled because #must_include? checks for :nodoc: in parent namespaces.

But this concern brings up that there should be specs for this to ensure the behaviour is implemented as inspected and won't change by future changes.
Granted, the doc generator specs are not very extensive. But that only means we need to write more tests, not less. I believe there should be ample existing examples that can be adapted to add relevant examples for testing this change.

@nobodywasishere
Copy link
Contributor Author

@ysbaddaden I believe the behavior determined during discussion with the RFC is that a :showdoc: inside a :nodoc: would prevent the showdoc from working.

@straight-shoota I can work on adding doc generator specs.

@nobodywasishere
Copy link
Contributor Author

@nobodywasishere
Copy link
Contributor Author

Let me know if you have more ideas for specs

@crysbot
Copy link
Collaborator

crysbot commented Jan 21, 2025

This pull request has been mentioned on Crystal Forum. There might be relevant details there:

https://forum.crystal-lang.org/t/win32cr-1-0-release/7630/2

Using :showdoc: on a namespace does not apply to child methods / objects
Copy link
Collaborator

@ysbaddaden ysbaddaden left a comment

Choose a reason for hiding this comment

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

Thank you! That looks all good to me.

@straight-shoota straight-shoota added this to the 1.16.0 milestone Feb 4, 2025
@straight-shoota straight-shoota merged commit 0da1746 into crystal-lang:master Feb 5, 2025
70 checks passed
@straight-shoota straight-shoota changed the title Add support for :showdoc: directive for private and protected objects (RFC #0011) Add :showdoc: directive for private and protected objects (RFC #0011) Feb 5, 2025
@nobodywasishere nobodywasishere deleted the nobody/add-showdoc-directive branch February 11, 2025 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants