Skip to content

How to display docstring output for function with multiple methods? #3103

Discussion options

You must be logged in to vote

Hey! There is no obvious way to do it, but this what I do:

begin
	f(x::String) = x
	f(x::Int) = x + 1

	@doc """
	```julia
	f(x::Union{String,Int})
	```

	Return something like `x`.
	
	""" f

end

Maybe you could also write your own macro? But docstrings are a bit tricky to work with in macros.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by nathanrboyer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants