diff --git a/README.md b/README.md index 126eab5a..78aa3c6f 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # DocumenterVitepress.jl -[![](https://img.shields.io/badge/docs-stable-blue.svg)](https://luxdl.github.io/DocumenterVitepress.jl) -[![](https://img.shields.io/badge/docs-dev-blue.svg)](https://luxdl.github.io/DocumenterVitepress.jl/dev) +[![](https://img.shields.io/badge/docs-stable-blue.svg)](https://luxdl.github.io/DocumenterVitepress.jl/stable/) +[![](https://img.shields.io/badge/docs-dev-blue.svg)](https://luxdl.github.io/DocumenterVitepress.jl/dev/) [![CI Documenter](https://github.com/LuxDL/DocumenterVitepress.jl/actions/workflows/Documenter.yml/badge.svg)](https://github.com/LuxDL/DocumenterVitepress.jl/actions/workflows/Documenter.yml) > [!TIP] -> Visit at https://luxdl.github.io/DocumenterVitepress.jl/dev +> Visit at https://luxdl.github.io/DocumenterVitepress.jl/dev/ This package provides a Markdown / MkDocs backend to [Documenter.jl](https://documenter.juliadocs.org/stable/). diff --git a/docs/src/.vitepress/config.mts b/docs/src/.vitepress/config.mts index 88e6a541..eff9e4f3 100644 --- a/docs/src/.vitepress/config.mts +++ b/docs/src/.vitepress/config.mts @@ -6,7 +6,7 @@ import { transformerMetaWordHighlight } from '@shikijs/transformers'; // https://vitepress.dev/reference/site-config export default defineConfig({ - base: 'REPLACE_ME_DOCUMENTER_VITEPRESS',// TODO: replace this in makedocs! + base: 'REPLACE_ME_DOCUMENTER_VITEPRESS', // TODO: replace this in makedocs! title: 'REPLACE_ME_DOCUMENTER_VITEPRESS', description: 'REPLACE_ME_DOCUMENTER_VITEPRESS', lastUpdated: true, @@ -52,7 +52,7 @@ export default defineConfig({ { icon: 'github', link: 'REPLACE_ME_DOCUMENTER_VITEPRESS' } ], footer: { - message: 'Made with Documenter.jl, VitePress and DocumenterVitepress.jl
', + message: 'Made with Documenter.jl, VitePress and DocumenterVitepress.jl
', copyright: `© Copyright ${new Date().getUTCFullYear()}.` } } diff --git a/docs/src/markdown-examples.md b/docs/src/markdown-examples.md index 75c4fc06..4a1ecdcb 100644 --- a/docs/src/markdown-examples.md +++ b/docs/src/markdown-examples.md @@ -6,107 +6,196 @@ This page demonstrates some of the built-in markdown extensions provided by Vite VitePress provides Syntax Highlighting powered by [Shiki](https://github.com/shikijs/shiki), with additional features like line-highlighting: +### Line Highlight + **Input** -Examples from [BeautifulAlgorithms.jl](https://github.com/mossr/BeautifulAlgorithms.jl/) +Code snippets from [gnuplot-examples](https://lazarusa.github.io/gnuplot-examples/). ```` ```julia -using Statistics, LinearAlgebra -function gradient_descent(𝒟train, φ, ∇loss; η=0.1, T=100) - 𝐰 = zeros(length(φ(𝒟train[1][1]))) - for t in 1:T - 𝐰 = 𝐰 .- η*mean(∇loss(x, y, 𝐰, φ) for (x,y) ∈ 𝒟train) # ‎[!code highlight] - end - return 𝐰 -end +using Gnuplot +x = -2π:0.001:2π +@gp x sin.(x) "w l t 'sin' lw 2 lc '#56B4E9'" "set grid" +@gp :- xrange = (-2π - 0.3, 2π + 0.3) yrange = (-1.1,1.1) +@gp :- x cos.(x) "w l t 'cos' lw 2 lc rgb '#E69F00'" # ‎[!code highlight] ``` ```` **Output** ```julia -using Statistics, LinearAlgebra -function gradient_descent(𝒟train, φ, ∇loss; η=0.1, T=100) - 𝐰 = zeros(length(φ(𝒟train[1][1]))) - for t in 1:T - 𝐰 = 𝐰 .- η*mean(∇loss(x, y, 𝐰, φ) for (x,y) ∈ 𝒟train) # [!code highlight] - end - return 𝐰 -end +using Gnuplot +x = -2π:0.001:2π +@gp x sin.(x) "w l t 'sin' lw 2 lc '#56B4E9'" "set grid" +@gp :- xrange = (-2π - 0.3, 2π + 0.3) yrange = (-1.1,1.1) +@gp :- x cos.(x) "w l t 'cos' lw 2 lc rgb '#E69F00'" # [!code highlight] ``` -### Code groups +### Highlight multiple lines **Input** + +```` +```julia +# ‎[!code highlight:3] +# up to 3 in order to highlight the previous 2 lines +using Gnuplot +x = -2π:0.001:2π +@gp x sin.(x) "w l t 'sin' lw 2 lc '#56B4E9'" "set grid" +@gp :- xrange = (-2π - 0.3, 2π + 0.3) yrange = (-1.1,1.1) +@gp :- x cos.(x) "w l t 'cos' lw 2 lc rgb '#E69F00'" # ‎[!code highlight] +``` ```` -::: code-group -```julia [neural network] -using LinearAlgebra -ReLU(z) = max(z, 0) -function neural_network(x, 𝐕, 𝐰, φ, g=ReLU) - 𝐡 = map(𝐯ⱼ -> g(𝐯ⱼ ⋅ φ(x)), 𝐕) - 𝐰 ⋅ 𝐡 -end +**Output** + +```julia +# [!code highlight:3] +using Gnuplot +x = -2π:0.001:2π +@gp x sin.(x) "w l t 'sin' lw 2 lc '#56B4E9'" "set grid" +@gp :- xrange = (-2π - 0.3, 2π + 0.3) yrange = (-1.1,1.1) +@gp :- x cos.(x) "w l t 'cos' lw 2 lc rgb '#E69F00'" # [!code highlight] +``` +Note the combination with `[!code highlight]`. + +### Focus a line + +**Input** +```` +```julia +using Gnuplot +x = -2π:0.001:2π +@gp x sin.(x) "w l t 'sin' lw 2 lc '#56B4E9'" "set grid" +@gp :- xrange = (-2π - 0.3, 2π + 0.3) yrange = (-1.1,1.1) +@gp :- x cos.(x) "w l t 'cos' lw 2 lc rgb '#E69F00'" # ‎[!code focus] ``` +```` -```julia [one-liner] -neural_network(x, 𝐕, 𝐰, φ, g) = 𝐰 ⋅ map(𝐯ⱼ -> g(𝐯ⱼ ⋅ φ(x)), 𝐕) +**Output** +```julia +using Gnuplot +x = -2π:0.001:2π +@gp x sin.(x) "w l t 'sin' lw 2 lc '#56B4E9'" "set grid" +@gp :- xrange = (-2π - 0.3, 2π + 0.3) yrange = (-1.1,1.1) +@gp :- x cos.(x) "w l t 'cos' lw 2 lc rgb '#E69F00'" # [!code focus] ``` -::: +### Focus multiple lines + +**Input** ```` +```julia +# ‎[!code focus:3] +using Gnuplot +x = -2π:0.001:2π +@gp x sin.(x) "w l t 'sin' lw 2 lc '#56B4E9'" "set grid" +@gp :- xrange = (-2π - 0.3, 2π + 0.3) yrange = (-1.1,1.1) +@gp :- x cos.(x) "w l t 'cos' lw 2 lc rgb '#E69F00'" # ‎[!code focus] # ‎[!code highlight] +``` +```` + **Output** +```julia +# [!code focus:3] +using Gnuplot +x = -2π:0.001:2π +@gp x sin.(x) "w l t 'sin' lw 2 lc '#56B4E9'" "set grid" +@gp :- xrange = (-2π - 0.3, 2π + 0.3) yrange = (-1.1,1.1) +@gp :- x cos.(x) "w l t 'cos' lw 2 lc rgb '#E69F00'" # [!code focus] # [!code highlight] +``` +Note the combination with `[!code focus]` and `[!code highlight]`. -::: code-group +### Added and removed lines -```julia [neural network] -using LinearAlgebra -ReLU(z) = max(z, 0) -function neural_network(x, 𝐕, 𝐰, φ, g=ReLU) - 𝐡 = map(𝐯ⱼ -> g(𝐯ⱼ ⋅ φ(x)), 𝐕) - 𝐰 ⋅ 𝐡 -end +**Input** +```` +```julia +using Gnuplot +x = -2π:0.001:2π +@gp x sin.(x) "w l t 'sin' lw 2 lc '#56B4E9'" "set grid" # ‎ [!code --] +@gp :- xrange = (-2π - 0.3, 2π + 0.3) yrange = (-1.1,1.1) +@gp :- x cos.(x) "w l t 'cos' lw 2 lc rgb '#E69F00'" # ‎[!code ++] # ‎[!code focus] ``` +```` -```julia [one-liner] -neural_network(x, 𝐕, 𝐰, φ, g) = 𝐰 ⋅ map(𝐯ⱼ -> g(𝐯ⱼ ⋅ φ(x)), 𝐕) +**Output** +```julia +using Gnuplot +x = -2π:0.001:2π +@gp x sin.(x) "w l t 'sin' lw 2 lc '#56B4E9'" "set grid" # [!code --] +@gp :- xrange = (-2π - 0.3, 2π + 0.3) yrange = (-1.1,1.1) +@gp :- x cos.(x) "w l t 'cos' lw 2 lc rgb '#E69F00'" # [!code ++] # [!code focus] ``` +Note the combination with `[!code focus]`. -::: +### Code error, code warning -### Code focus **Input** ```` ```julia -using LinearAlgebra -function stochastic_gradient_descent(𝒟train, φ, ∇loss; η=0.1, T=100) - 𝐰 = zeros(length(φ(𝒟train[1][1]))) - for t in 1:T - for (x, y) ∈ 𝒟train - 𝐰 = 𝐰 .- η*∇loss(x, y, 𝐰, φ) # ‎[!code focus] - end - end - return 𝐰 -end +using Gnuplot +x = -2π:0.001:2π +@gp x sin.(x) "w l t 'sin' lw 2 lc '#56B4E9'" "set gridss" # ‎ [!code error] +@gp :- xrange = (-2π - 0.3, 2π + 0.3) yrange = (-1.1,1.1) +@gp :- x cos.(x) "w l t 'cos' lw 2 lc rgba '#E69F00'" # ‎[!code warning] ``` ```` **Output** + ```julia -using LinearAlgebra -function stochastic_gradient_descent(𝒟train, φ, ∇loss; η=0.1, T=100) - 𝐰 = zeros(length(φ(𝒟train[1][1]))) - for t in 1:T - for (x, y) ∈ 𝒟train - 𝐰 = 𝐰 .- η*∇loss(x, y, 𝐰, φ) # [!code focus] - end - end - return 𝐰 -end +using Gnuplot +x = -2π:0.001:2π +@gp x sin.(x) "w l t 'sin' lw 2 lc '#56B4E9'" "set gridss" # [!code error] +@gp :- xrange = (-2π - 0.3, 2π + 0.3) yrange = (-1.1,1.1) +@gp :- x cos.(x) "w l t 'cos' lw 2 lc rgba '#E69F00'" # [!code warning] +``` + +### Code groups + +**Input** +```` +::: code-group + +```julia [one line] +using Gnuplot +t = 0:0.001:1 +@gp t sin.(10π*t) "w l tit 'sin' lc 'gray'" ``` +```julia [two lines] +using Gnuplot +x = -2π:0.001:2π +@gp x sin.(x) "w l t 'sin' lw 2 lc '#56B4E9'" "set grid" +@gp :- xrange = (-2π - 0.3, 2π + 0.3) yrange = (-1.1,1.1) +@gp :- x cos.(x) "w l t 'cos' lw 2 lc rgb '#E69F00'" +``` + +::: +```` +**Output** + +::: code-group + +```julia [one line] +using Gnuplot +t = 0:0.001:1 +@gp t sin.(10π*t) "w l tit 'sin' lc 'gray'" +``` + +```julia [two lines] +using Gnuplot +x = -2π:0.001:2π +@gp x sin.(x) "w l t 'sin' lw 2 lc '#56B4E9'" "set grid" +@gp :- xrange = (-2π - 0.3, 2π + 0.3) yrange = (-1.1,1.1) +@gp :- x cos.(x) "w l t 'cos' lw 2 lc rgb '#E69F00'" +``` + +::: + + ### Lists **Input** @@ -324,7 +413,7 @@ d content 2 ## GitHub-flavored Alerts -See: https://vitepress.dev/guide/markdown#github-flavored-alerts +See [github-flavored-alerts](https://vitepress.dev/guide/markdown#github-flavored-alerts) **Input** ```` @@ -338,7 +427,7 @@ See: https://vitepress.dev/guide/markdown#github-flavored-alerts > Critical content. ## Tables -See: https://vitepress.dev/guide/markdown#github-style-tables +See [github-style-tables](https://vitepress.dev/guide/markdown#github-style-tables) **Input** ````