Created
January 20, 2015 03:43
-
-
Save hayd/bdddb51dc7df89b9a24e to your computer and use it in GitHub Desktop.
MetaDoc type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type MetaDoc | |
docstring::Base.Markdown.MD | |
sections::Vector{Pair} | |
MetaDoc(docstring, sections) = new(docstring, [sections]) | |
MetaDoc(docstring, sections...) = new(docstring, [sections...]) | |
end | |
m = MetaDoc(doc"....docs.... for `m`", :author=>"Me", :section=>"Foo functions") | |
function Base.display(d::Base.REPL.REPLDisplay, m::MetaDoc) | |
display(d, m.docstring) | |
for (section, md) in m.sections | |
display(d, Base.Markdown.MD([Base.Markdown.Header([string(section)]), | |
Base.Markdown.Paragraph([md]), | |
])) | |
end | |
end | |
# so far so good | |
# m prints as you might hope | |
@doc m -> function foo() end | |
##### but help doesn't work... | |
julia> @doc foo | |
2-element Array{Any,1}: | |
Base.Markdown.MD(Any[foo()],Dict{Any,Any}()) | |
MetaDoc(Base.Markdown.MD(Any[Base.Markdown.Paragraph(Any["....docs.... for ",Base.Markdown.Code("","m")])],Dict{Any,Any}(:path=>nothing,:module=>Main)),Pair{K,V}[:author=>"Me",:section=>"Foo functions"]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment