I have a string macro I'd like to document after-the-fact.
Looking at the @doc
docs I see the section where it says to try @doc "..." :(mystr"")
or @doc "..." :(@Module.macro)
however I haven't had any success with either of those forms. Looking at Docs.jl
I see
# For the special `:@mac` / `:(Base.@mac)` syntax for documenting a macro after definition.
isquotedmacrocall(@nospecialize x) =
isexpr(x, :copyast, 1) &&
isa(x.args[1], QuoteNode) &&
isexpr(x.args[1].value, :macrocall, 2)
However isquotedmacrocall
seems to return false for both of the forms mentioned in that comment (@mac
, :(Base.@mac)
), and so I'm at bit of a loss.
Does the syntax
"""
name"..."
Something something.
"""
:(@name_str)
work? See https://docs.julialang.org/en/v1/manual/documentation/#Macros.
This is quite odd. That did work, but going through my edit history I've already tried that before. I wonder if this could have been Revise.jl / state mutation -related weirdness.
In a fresh Julia session :(@name_str)
is fine, but in my original session I tried all of the following without success:
:(org"")
:(@org_str)
:@org_str
:(:@org_str))
:($(QuoteNode(:(@org_str))))
Timothy has marked this topic as resolved.
Last updated: Dec 28 2024 at 04:38 UTC