Internal API
These functions are not part of the public API, and are subject to change without notice.
DocumenterVitepress._escape_yaml_double_quoted Method
_escape_yaml_double_quoted(value) -> StringEscape 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.
DocumenterVitepress._strip_frontmatter_delimiters Method
_strip_frontmatter_delimiters(text) -> StringInner YAML of a ---…--- block, robust to a trailing newline that a plain split[2:end-1] would mishandle (leaving the closing ---).
DocumenterVitepress.apply_noindex Method
apply_noindex(config::AbstractString, noindex_non_stable::Bool, base::AbstractString) -> StringInject 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.
DocumenterVitepress.build_docs Method
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.
DocumenterVitepress.deploydocs Method
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.
DocumenterVitepress.dev_docs Method
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.
DocumenterVitepress.docpath Method
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.
DocumenterVitepress.generate_template Function
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
generate_template(".julia/dev/MyPackage/docs", "MyPackage")DocumenterVitepress.inject_plugin_components! Method
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.
DocumenterVitepress.merge_plugin_dependencies! Method
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.
DocumenterVitepress.mime_priority Function
mime_priority(mime::MIME)::Float64This 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.
sourceDocumenterVitepress.modify_config_file Method
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.
DocumenterVitepress.render Function
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:
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.
DocumenterVitepress.vitepress_assets Method
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.
DocumenterVitepress.vitepress_components Method
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.
DocumenterVitepress.vitepress_config_transform Method
vitepress_config_transform(plugin::Documenter.Plugin, config::String) -> StringTransform 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.
DocumenterVitepress.vitepress_dependencies Method
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.
DocumenterVitepress.write_redirect_index! Method
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).