Skip to content

Julia code example

The Julia code used here is done using the following packages versions:

julia
using Pkg
Pkg.status()
Status `~/work/DocumenterVitepress.jl/DocumenterVitepress.jl/docs/Project.toml`
  [e30172f5] Documenter v1.3.0
  [4710194d] DocumenterVitepress v0.0.15 `~/work/DocumenterVitepress.jl/DocumenterVitepress.jl`

And a simple task:

julia
2 + 2
4

ANSI example

julia
julia> printstyled("this is my color"; color = :red)
this is my color

A more colorful example from documenter:

julia
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

Font

This package uses the JuliaMono font by default, but you can override this in CSS.

This is what some common symbols look like:

julia
] [ = $ ; ( @ { " ) ? . } ⊽ ⊼ ⊻ ⊋ ⊊ ⊉ ⊈ ⊇ ⊆ ≥ ≤ ≢ ≡ ≠ ≉ ≈ ∪ ∩ ∜ ∛ √ ∘ ∌
|> /> ^ % ` ∈

Eval example

From Julia's documentation landing page.

Julia 1.10 Documentation

Welcome to the documentation for Julia 1.10.

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 example

julia
julia> a = 1
1
julia> b = 2
2
julia> a + b
3