Internal API
These functions are not part of the public API, and are subject to change without notice.
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.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.mime_priority Function
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.
DocumenterVitepress.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.