Skip to content

Internal API

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

DocumenterVitepress._escape_yaml_double_quoted Method
julia
_escape_yaml_double_quoted(value) -> String

Escape value for embedding in a double-quoted YAML scalar (key: "..."). Page titles/descriptions from page.globals.meta are arbitrary text; an unescaped " or newline would otherwise close the scalar early and break the frontmatter.

source
DocumenterVitepress._strip_frontmatter_delimiters Method
julia
_strip_frontmatter_delimiters(text) -> String

Inner YAML of a ---…--- block, robust to a trailing newline that a plain split[2:end-1] would mishandle (leaving the closing ---).

source
DocumenterVitepress.apply_noindex Method
julia
apply_noindex(config::AbstractString, noindex_non_stable::Bool, base::AbstractString) -> String

Inject a noindex, nofollow robots meta into config for non-stable, non-root deployments. Replaces the marker if present, else injects into the head array; warns and returns config unchanged if neither is found.

source
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.deploydocs Method
julia
deploydocs(; repo, target, branch, devbranch, push_preview, kwargs...)

Deploy the documentation built with DocumenterVitepress.

The repo keyword argument is required, all others are optional and default to the defaults of Documenter.deploydocs (see its documentation for more details).

This function only shares a name with Documenter.deploydocs, it should therefore be invoked with DocumenterVitepress.deploydocs. Because of DocumenterVitepress's need to build a separate website for each base alias like v1.2.3, v1.2, v1 and stable, the deployment using Documenter.deploydocs does not work with the default settings. This function offers a wrapper over Documenter.deploydocs which deploys each separate build in sequence.

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.inject_plugin_components! Method
julia
inject_plugin_components!(theme_index_path::String, doc)

Inject every plugin's vitepress_components into theme_index_path at its two injection markers. Warns and no-ops if a custom theme lacks them, or if no components are contributed.

source
DocumenterVitepress.merge_plugin_dependencies! Method
julia
merge_plugin_dependencies!(package_json_path::String, doc)

Merge every plugin's vitepress_dependencies into the dependencies object of the package.json at package_json_path, rewriting it in place (2-space indent, trailing newline). No-op when no plugin contributes a dependency.

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
DocumenterVitepress.vitepress_assets Method
julia
vitepress_assets(plugin::Documenter.Plugin) -> Vector{String}

Absolute directory paths whose contents are copied into the Vitepress public/ directory (a file lands at public/<filename>). Missing paths are warned about and skipped. Default: empty.

source
DocumenterVitepress.vitepress_components Method
julia
vitepress_components(plugin::Documenter.Plugin) -> Vector{@NamedTuple{name::String, import_path::String}}

Vue components to register globally in theme/index.ts via app.component(name, …). import_path is anything Vite can resolve ("my-pkg/Component.vue", a relative path, etc.); name should be a valid JS identifier. Default: empty.

source
DocumenterVitepress.vitepress_config_transform Method
julia
vitepress_config_transform(plugin::Documenter.Plugin, config::String) -> String

Transform the config.mts source, called once per plugin after DocumenterVitepress's own substitutions. Default: identity. Edits should key off a stable marker rather than exact whitespace so they survive template changes.

source
DocumenterVitepress.vitepress_dependencies Method
julia
vitepress_dependencies(plugin::Documenter.Plugin) -> Dict{String,String}

npm dependencies to merge into the generated package.json, just before npm install. Values are npm specifiers: a version range ("^1.2.3"), a local path ("file:/abs/path"), a git URL, etc. Default: empty.

source
DocumenterVitepress.write_redirect_index! Method
julia
write_redirect_index!(root, target)

Write root/index.html as a meta-refresh redirect to ./target/, mirroring what Documenter.deploydocs does for the standard versions= argument. No-op if target is nothing, or if index.html exists and wasn't generated by Documenter or DocumenterVitepress (a user-provided landing page is left alone).

source