Skip to content

Commit

Permalink
Merge 8b39396 into 763aa13
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal authored Sep 20, 2024
2 parents 763aa13 + 8b39396 commit b258576
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "DocumenterVitepress"
uuid = "4710194d-e776-4893-9690-8d956a29c365"
authors = ["Lazaro Alonso <[email protected]>", "Anshul Singhvi <[email protected]>"]
version = "0.1.2"
version = "0.1.3"

[deps]
ANSIColoredPrinters = "a4c015fc-c6ff-483c-b24f-f7ea428134e9"
Expand Down
1 change: 1 addition & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ makedocs(;
],
"Developers' documentation" => [
"The rendering process" => "render_pipeline.md",
"Internal API" => "internal_api.md",
],
"api.md",
],
Expand Down
3 changes: 2 additions & 1 deletion docs/src/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ outline: deep
```

## Public API

```@meta
DocTestSetup= quote
DocTestSetup = quote
using DocumenterVitepress
end
```
Expand Down
17 changes: 17 additions & 0 deletions docs/src/code_example.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
````
22 changes: 22 additions & 0 deletions docs/src/internal_api.md
Original file line number Diff line number Diff line change
@@ -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
```
5 changes: 3 additions & 2 deletions src/writer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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 = """<Badge type="info" class="jlObjectType jl$(Documenter.doccat(docs.object))" text="$(Documenter.doccat(docs.object))" />"""
print(io ,"""<details class='jldocstring custom-block' open>
<summary><a id='$(anchor_id)' href='#$(anchor_id)'>#</a> <span class="jlbinding">$(docs.object.binding)</span> $(_badge_text)</summary>\n
print(io ,"""<details class='jldocstring custom-block' $(open_txt)>
<summary><a id='$(anchor_id)' href='#$(anchor_id)'><span class="jlbinding">$(docs.object.binding)</span></a> $(_badge_text)</summary>\n
""")
# Body. May contain several concatenated docstrings.
renderdoc(io, mime, node, page, doc; kwargs...)
Expand Down

0 comments on commit b258576

Please sign in to comment.