diff --git a/Project.toml b/Project.toml index eeff70c..0394197 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "DocumenterVitepress" uuid = "4710194d-e776-4893-9690-8d956a29c365" authors = ["Lazaro Alonso ", "Anshul Singhvi "] -version = "0.1.2" +version = "0.1.3" [deps] ANSIColoredPrinters = "a4c015fc-c6ff-483c-b24f-f7ea428134e9" diff --git a/docs/make.jl b/docs/make.jl index efb8bea..147e875 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -53,6 +53,7 @@ makedocs(; ], "Developers' documentation" => [ "The rendering process" => "render_pipeline.md", + "Internal API" => "internal_api.md", ], "api.md", ], diff --git a/docs/src/api.md b/docs/src/api.md index 8d2efd9..6d33a26 100644 --- a/docs/src/api.md +++ b/docs/src/api.md @@ -5,8 +5,9 @@ outline: deep ``` ## Public API + ```@meta -DocTestSetup= quote +DocTestSetup = quote using DocumenterVitepress end ``` diff --git a/docs/src/code_example.md b/docs/src/code_example.md index 171416c..a150e37 100644 --- a/docs/src/code_example.md +++ b/docs/src/code_example.md @@ -199,3 +199,20 @@ julia> 1 + 1 2 ``` + +## @meta + +Supported meta tags: + + - `CollapsedDocStrings`: works similar to Documenter.jl. If provided, the docstrings in + that page will be collapsed by default. Defaults to `false`. See the + [Internal API](@ref internal_api) page for how the docstrings are displayed when this + is set to `true`. Example usage: + +**Input** + +```` +```@meta +CollapsedDocStrings = true +``` +```` diff --git a/docs/src/internal_api.md b/docs/src/internal_api.md new file mode 100644 index 0000000..28db2ff --- /dev/null +++ b/docs/src/internal_api.md @@ -0,0 +1,22 @@ +```@raw html +--- +outline: deep +--- +``` + +## [Internal API](@id internal_api) + +These functions are not part of the public API, and are subject to change without notice. + +```@meta +CollapsedDocStrings = true + +DocTestSetup = quote +using DocumenterVitepress +end +``` + +```@autodocs +Modules = [DocumenterVitepress] +Public = false +``` diff --git a/src/writer.jl b/src/writer.jl index 4397428..4d29a36 100644 --- a/src/writer.jl +++ b/src/writer.jl @@ -313,11 +313,12 @@ end function render(io::IO, mime::MIME"text/plain", node::Documenter.MarkdownAST.Node, docs::Documenter.DocsNode, page, doc; kwargs...) # @infiltrate + open_txt = get(page.globals.meta, :CollapsedDocStrings, false) ? "" : "open" anchor_id = Documenter.anchor_label(docs.anchor) # Docstring header based on the name of the binding and it's category. _badge_text = """""" - print(io ,"""
- # $(docs.object.binding) $(_badge_text)\n + print(io ,"""
+ $(docs.object.binding) $(_badge_text)\n """) # Body. May contain several concatenated docstrings. renderdoc(io, mime, node, page, doc; kwargs...)