Hmm, thanks but very trick. So how do I do to capture the output of @doc inside a function? And why does typeof() sees that fun is a variable but @doc takes it literally?
julia> function doc(fun)
@show(typeof(fun))
@show(html(@doc(fun)))
end
doc (generic function with 1 method)
julia> doc(sin)
typeof(fun) = typeof(sin)
html(#= REPL[8]:3 =# @doc(fun)) = "<p>No documentation found.</p>\n<p>Binding <code>fun</code> does not exist.</p>\n"
"<p>No documentation found.</p>\n<p>Binding <code>fun</code> does not exist.</p>\n"
Macros are “run” at macroexpansion time which is before the function is run. In other words, macros operate on syntax. The correct thing is indeed to use a function here instead of a macro.