Skip to content

Internal API

These functions are not part of the public API, and are subject to change without notice.

DocumenterVitepress.build_docs Method
julia
build_docs(builddir::String; md_output_path = ".documenter")

Builds the Vitepress site in the given directory.

If passing a String, pass the path to the builddir, i.e., $packagepath/docs/build.

source

DocumenterVitepress.dev_docs Method
julia
dev_docs(builddir::String; md_output_path = ".documenter")

Runs the vitepress dev server to serve the docs built from the Markdown files (generated by makedocs) in the given directory.

If passing a String, pass the path to the builddir, i.e., $packagepath/docs/build.

For now, these assume that the Markdown files generated are in $builddir/.documenter. Work is in progress to let the user pass the config object to fix this.

Warning

This does NOT run makedocs - you have to do that yourself! Think of it as the second stage of LiveServer.jl for DocumenterVitepress specifically.

source

DocumenterVitepress.docpath Method
julia
docpath(file, mdfolder)

This function takes the filename file, and returns a file path in the mdfolder directory which has the same tree as the src directory. This is used to ensure that the Markdown files are output in the correct location for Vitepress to find them.

source

DocumenterVitepress.generate_template Function
julia
generate_template(target_directory::String, package = "YourPackage")

Copies template files from DocumenterVitepress.jl to a target directory, replacing "YourPackage" with the specified package name in package.

target should be the directory of your package's documentation, and not its root!

Skips existing files and only updates new ones.

Arguments

  • target_directory: Destination for template files.

  • package: Name to replace "YourPackage" with, defaulting to "YourPackage".

Example

julia
generate_template(".julia/dev/MyPackage/docs", "MyPackage")

source

DocumenterVitepress.mime_priority Function
julia
mime_priority(mime::MIME)::Float64

This function returns a priority for a given MIME type, which is used to select the best MIME type for rendering a given element. Priority is in ascending order, i.e., 1 has more priority than 0.

source

DocumenterVitepress.modify_config_file Method
julia
modify_config_file(doc, settings, deploy_decision)

Modifies the config file located at \$builddir/\$md_output_path/.vitepress/config.mts to include attributes determined at runtime.

In general, the config file will contain various strings like REPLACE_ME_DOCUMENTER_VITEPRESS which this function will replace with content.

Replaced config items

Currently, this function replaces the following config items:

  • Vitepress base path (base)

  • Vitepress output path (outDir)

  • Navbar

  • Sidebar

  • Title

  • Edit link

  • Github repo link

  • Logo

  • Favicon

Adding new config hooks

Simply add more elements to the replacers array within this function.

source

DocumenterVitepress.render Function
julia
render(args...)

This is the main entry point and recursive function to render a Documenter document to Markdown in the Vitepress flavour. It is called by Documenter.build and should not be called directly.

Methods

To extend this function, the general signature is:

julia
render(io::IO, mime::MIME"text/plain", node::Documenter.MarkdownAST.Node, element::Eltype, page, doc; kwargs...)

where Eltype is the type of the element field of the node object which you care about.

source