Upgrading docs from Documenter.jl to DocumenterVitepress.jl
Assuming that your current documentation is based on Documenter.jl, you can upgrade to DocumenterVitepress.jl by following these steps:
Let us suppose that you are working on a package named Example.jl
that is part of a GitHub organization named ExampleOrg
.
Then the very first step here is to update the make.jl
file to follow the DocumenterVitepress.jl format.
Go the the
make.jl
file in yourdocs
folder and do the following necessary changes to upgrade to DocumenterVitepress.jl::::tabs
== From Documenter.jl
a. The
make.jl
file withDocumenter.jl
should look like this:using Example using Documenter DocMeta.setdocmeta!(test, :DocTestSetup, :(using test); recursive=true) makedocs(; modules = [test], authors = "jay-sanjay <landgejay124@gmail.com> and contributors", sitename = "Example.jl", format = Documenter.HTML(; canonical = "https://jay-sanjay.github.io/Example.jl", edit_link = "main", assets = String[], ), pages=[ "Home" => "index.md", "Tutorials" => "tutorials.md", "Api" => "api.md", "Contributing" => "contributing.md" ], ) deploydocs(; repo = "github.com/jay-sanjay/Example.jl", devbranch = "main", )
== to DocumenterVitepress.jl
b. The same
make.jl
file withDocumenterVitepress.jl
will look like this:using Example using Documenter using DocumenterVitepress DocMeta.setdocmeta!(Example, :DocTestSetup, :(using Example); recursive=true) makedocs(; modules = [Example], repo = Remotes.GitHub("ExampleOrg", "Example.jl"), authors = "Jay-sanjay <landgejay124@gmail.com>, and contributors", sitename = "Example.jl", format = DocumenterVitepress.MarkdownVitepress( repo="https://github.com/ExampleOrg/Example.jl", ), pages = [ "Home" => "index.md", "Tutorials" => "tutorials.md", "Api" => "api.md", "Contributing" => "contributing.md" ], ) deploydocs(; repo = "github.com/ExampleOrg/Example.jl", target = "build", # this is where Vitepress stores its output devbranch = "main", branch = "gh-pages", push_preview = true )
:::
Next to build new docs from docs/src
$ cd docs docs $
Then, in docs start a julia session and activate a new environment.
docs $ julia julia> ] pkg> activate .
Add packages as necessary. Here, we will need
pkg> add DocumenterVitepress, Documenter
Then run the
make.jl
file to build the documentation.julia> include("make.jl")
Finally hit
;
to enter in the shell mode and run:shell> npm i
The above command shall create a folder named
node_modules
andpackage-lock.json
in your docs folder.Next hit 'Backspace' to get back to the julia REPL and run:
juila> DocumenterVitepress.dev_docs("docs/build")
Finally the live preview of your documentation at
hhttp://localhost:5173/Example.jl/
in your browser.