Julia code examples
Fonts
This package uses the JuliaMono font by default, but you can override this in CSS.
This is what some common symbols look like:
] [ = $ ; ( @ { " ) ? . } ⊽ ⊼ ⊻ ⊋ ⊊ ⊉ ⊈ ⊇ ⊆ ≥ ≤ ≢ ≡ ≠ ≉ ≈ ∪ ∩ ∜ ∛ √ ∘ ∌
|> /> ^ % ` ∈@example
The Julia code used here is done using the following packages versions:
Input
```@example version
using Pkg
Pkg.status()
```Output
using Pkg
Pkg.status()Status `~/work/DocumenterVitepress.jl/DocumenterVitepress.jl/docs/Project.toml`
[a93c6f00] DataFrames v1.8.1
[e30172f5] Documenter v1.15.0
[daee34ce] DocumenterCitations v1.4.1
[d12716ef] DocumenterInterLinks v1.1.0
[4710194d] DocumenterVitepress v0.2.7 `~/work/DocumenterVitepress.jl/DocumenterVitepress.jl`
[b964fa9f] LaTeXStrings v1.4.0And a simple sum:
Input
```@example simple_sum
2 + 2
```Output
2 + 24@ansi
Input
```@ansi
printstyled("this is my color"; color = :red)
```Output
julia> printstyled("this is my color"; color = :red)this is my colorA more colorful example from documenter:
Input
```@ansi
for color in 0:15
print("\e[38;5;$color;48;5;$(color)m ")
print("\e[49m", lpad(color, 3), " ")
color % 8 == 7 && println() # [!code highlight]
end
```Output
julia> for color in 0:15
print("\e[38;5;$color;48;5;$(color)m ")
print("\e[49m", lpad(color, 3), " ")
color % 8 == 7 && println()
end 0 1 2 3 4 5 6 7
8 9 10 11 12 13 14 15@eval
From Julia's documentation landing page.
Input
```@eval
io = IOBuffer()
release = isempty(VERSION.prerelease)
v = "$(VERSION.major).$(VERSION.minor)"
!release && (v = v*"-$(first(VERSION.prerelease))")
print(io, """
# Julia $(v) Documentation
Welcome to the documentation for Julia $(v).
""")
if true # !release
print(io,"""
!!! warning "Work in progress!"
This documentation is for an unreleased, in-development, version of Julia.
""")
end
import Markdown
Markdown.parse(String(take!(io)))
```
```@eval
file = "julia-1.10.2.pdf"
url = "https://raw.githubusercontent.com/JuliaLang/docs.julialang.org/assets/$(file)"
import Markdown
Markdown.parse("""
!!! note
The documentation is also available in PDF format: [$file]($url).
""")
```Output
Julia 1.12 Documentation
Welcome to the documentation for Julia 1.12.
Work in progress!
This documentation is for an unreleased, in-development, version of Julia.
Note
The documentation is also available in PDF format: julia-1.10.2.pdf.
@repl
Input
```@repl
a = 1;
b = 2;
a + b
```Output
julia> a = 1;
julia> b = 2;
julia> a + b
3Input
```@repl
a = 1;
b = 2; # [!code focus] # hide
a + b
```Output
julia> a = 1;
julia> a + b
3@doctest
Input
```@doctest
julia> 1 + 1
2
```Output
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 tofalse. See the Internal API page for how the docstrings are displayed when this is set totrue. Example usage:
Input
```@meta
CollapsedDocStrings = true
```@contents
Use this to create a list of content.
Input
```@contents
Pages = [
"get_started.md",
"documenter_to_vitepress_docs_example.md",
"style_css.md",
"code_example.md",
"markdown-examples.md",
"mime_examples.md",
"citations.md",
"style_css.md",
"author_badge.md",
"repo_stars.md",
"../devs/render_pipeline.md",
"../devs/internal_api.md",
"../api.md"
]
Depth = 3
```Output
- Get Started
- Upgrading docs from Documenter.jl to DocumenterVitepress.jl
- Julia code examples
- Markdown Extension Examples
- MIME type examples
- DocumenterCitations.jl integration
- gallery
- CSS Styling
- AuthorBadge and platform icons
- GitHub Icon with Stars
- The rendering process
- internal_api
- Public API