-
Notifications
You must be signed in to change notification settings - Fork 31
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
feature request: non-api doc marker #134
Comments
If we decide on some API for this, then we can also get it into Documenter. There has been some discussion about something like this: JuliaDocs/Documenter.jl#1507 and JuliaDocs/Documenter.jl#1506 Marking docstrings private, rather than making them public, might be a nice way to go about this though. Do you have a proof-of-concept implementation with string interpolation? |
Not really, because it seems that string is not recognized as a doc entry if the tripled-quoted string is interpolated into a macro. But I'm pretty much ignorant about how these macros work, so I may be just missing a very basic thing here. julia> macro INTERNAL_str(string)
return(string)
end
@INTERNAL_str (macro with 1 method)
julia> INTERNAL"""
f(x)
"""
f(x) = 1
f (generic function with 1 method)
help?> f
search: f fd for fma fld fld1 fill fdio frexp foldr foldl flush floor float first fill! fetch fldmod filter falses finally foreach
No documentation found.
f is a Function.
# 1 method for generic function "f":
[1] f(x) in Main at REPL[4]:4 ps: But if I find a way to propose something more concrete, I will post it here, of course. |
Yeah, the parser doesn't recognise arbitrary string macros as docstrings, only normal string literals. This feature can be added as a Here's an implementation based on what I wrote back in that linked PR, but just flipped to be an
Any consuming package or user can then just query any docstring with |
With the X-ref: JuliaLang/julia#50105 |
Maybe yes. Actually I feel there is some lack of support for internal-function docstrings in Documenter still (I have been converting them into comments, which is not really ideal), but I guess this is not an issue for DocStringExtensions anyway. (with the |
Yes, I meant that the metadata bit should be handled by the keyword now. Documenter integration is tracked in JuliaDocs/Documenter.jl#1506, and is definitely something we'd want to have. |
Y just saw at the state of julia talk that base will already provide the warning message, in exactly this format. So we definitely can close this. |
The idea is to have a macro, let us say, INTERNAL, such that a message warning the user that the function is internal is shown instead of the actual help entry, and the help entry gets hidden inside an "Extended help" section.
That is, that some like this:
gets parsed as:
Such that when the user types
? f
, he/she will get:Ps: I tried to implement this myself, but without a proper interaction with
Documenter
it does not really help much, and maybe others have the right expertise to do that (if they find the idea interesting, anyway). I have been using this pattern, by hand, in some packages, and it solves the problem of documenting inner functions without introducing possible confusions for the users.The text was updated successfully, but these errors were encountered: