MultiDocumenter
This package aggregates Documenter.jl documentation from multiple sources into one page with a global search bar.
Example usage
using MultiDocumenter
clonedir = mktempdir()
docs = [
MultiDocumenter.DropdownNav("Debugging", [
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "Infiltrator"),
path = "inf",
name = "Infiltrator",
giturl = "https://github.com/JuliaDebug/Infiltrator.jl.git",
),
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "JuliaInterpreter"),
path = "debug",
name = "JuliaInterpreter",
giturl = "https://github.com/JuliaDebug/JuliaInterpreter.jl.git",
),
]),
MultiDocumenter.MegaDropdownNav("Mega Debugger", [
MultiDocumenter.Column("Column 1", [
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "Infiltrator"),
path = "inf",
name = "Infiltrator",
giturl = "https://github.com/JuliaDebug/Infiltrator.jl.git",
),
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "JuliaInterpreter"),
path = "debug",
name = "JuliaInterpreter",
giturl = "https://github.com/JuliaDebug/JuliaInterpreter.jl.git",
),
]),
MultiDocumenter.Column("Column 2", [
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "Infiltrator"),
path = "inf",
name = "Infiltrator",
giturl = "https://github.com/JuliaDebug/Infiltrator.jl.git",
),
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "JuliaInterpreter"),
path = "debug",
name = "JuliaInterpreter",
giturl = "https://github.com/JuliaDebug/JuliaInterpreter.jl.git",
),
]),
]),
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "DataSets"),
path = "data",
name = "DataSets",
giturl = "https://github.com/JuliaComputing/DataSets.jl.git",
# or use ssh instead for private repos:
# giturl = "git@github.com:JuliaComputing/DataSets.jl.git",
),
]
outpath = joinpath(@__DIR__, "out")
MultiDocumenter.make(
outpath,
docs;
search_engine = MultiDocumenter.SearchConfig(
index_versions = ["stable"],
engine = MultiDocumenter.FlexSearch
)
)
Deployment
Check .github/workflows/deploy.yml
and docs/make.jl
for an example on how to deploy MultiDocumenter-generated aggregates to a git branch.
The result of that script is available at https://juliacomputing.github.io/MultiDocumenter.jl/.
You can of course also just push the output artefact directly to S3 or some other hosting service.
Warning MultiDocumenter sites can not be deployed on Windows right now, and the
make()
function will throw an error. See #70.It is still possible to develop and debug MultiDocumenter sites on Windows if the build script is run interactively (e.g. by
include
-ing it into a REPL session).
Docstrings
MultiDocumenter.DropdownComponent
— Typeabstract type DropdownComponent
The supertype for any component that can be put in a dropdown column and rendered using MultiDocumenter.render(::YourComponent, thispagepath, dir, prettyurls)
.
All DropdownComponent
s go in Column
s, which go in MegaDropdownNav
.
Any subtype of DropdownComponent
must implement that render
method.
The main subtype is MultiDocRef
, which refers to external documentation and adds it to the search index. However, there are others like Link
which is used to link to external sites without making them searchable, and users can implement their own custom components.
MultiDocumenter.Link
— TypeLink([text::String], link::String, [isexternal::Bool]) <: DropdownComponent
Represents a link to an external site.
MultiDocumenter.MultiDocRef
— Typestruct MultiDocRef <: DropdownComponent
MultiDocRef(; upstream, name, path, giturl = "", branch = "gh-pages", fix_canonical_url = true)
Represents one set of docs that will get an entry in the MultiDocumenter navigation.
Required arguments:
upstream
: the local directory where the documentation is located. Ifgiturl
is passed, MultiDocumenter will clone into this directory.name
: string used in the MultiDocumenter navigation for this itempath
: the URL path under which the contents of upstream is placed
Optional arguments:
giturl
: URL of the remote Git repository that will be cloned. If this is unset, thenupstream
must be an existing directory.branch
: Git branch ofgiturl
where the docs will be pulled from (defaults togh-pages
)fix_canonical_url
: this can be set tofalse
to disable the canonical URL fixing for thisMultiDocRef
(see alsocanonical_domain
formake
).
MultiDocumenter.SearchConfig
— TypeSearchConfig(index_versions = ["stable"], engine = MultiDocumenter.PageFind, lowfi = false)
index_versions
is a vector of relative paths used for generating the search index. Only the first matching path is considered. engine
may be MultiDocumenter.PageFind
, MultiDocumenter.FlexSearch
, MultiDocumenter.Stork
, or a module that conforms to the expected API (which is currently undocumented). lowfi = true
will try to minimize search index size. Only relevant for flexsearch.
MultiDocumenter.make
— Methodmake(
outdir,
docs::Vector{MultiDocRef};
assets_dir,
brand_image,
custom_stylesheets = [],
custom_scripts = [],
search_engine = SearchConfig(),
prettyurls = true,
rootpath = "/",
hide_previews = true,
canonical = nothing,
)
Aggregates multiple Documenter.jl-based documentation pages docs
into outdir
.
assets_dir
is copied intooutdir/assets
brand_image
is aBrandImage(path, imgpath)
, which is rendered as the leftmost item in the global navigationcustom_stylesheets
is aVector{String}
of relative stylesheet URLs injected into each page.custom_scripts
is aVector{Union{String, Docs.HTML}}
. Strings can be relative or absolute URLs, whileDocs.HTML
objects are inserted as the content of inline scripts.search_engine
inserts a global search bar if notfalse
. SeeSearchConfig
for more details.prettyurls
removes allindex.html
suffixes from links in the global navigation.rootpath
is the path your site ends up being deployed at, e.g./foo/
if it's hosted athttps://bar.com/foo
hide_previews
removes preview builds from the aggregated documentation.canonical_domain
: determines the the schema and authority (domain) of the (e.g.https://example.org
) deployed site. If set, MultiDocumenter will check and, if necessary, update the canonical URL tags for each package site to point to the correct place directory. Similar to thecanonical
argument ofDocumenter.HTML
constructor, except that it should not contain the path component – that is determined fromrootpath
.sitemap
, if enabled, will generate asitemap.xml
file at the root of the output directory. Requirescanonical_domain
to be set, since the sitemap is determined from canonical URLs.sitemap_filename
can be used to override the default sitemap filename (sitemap.xml
)