Usage

Note

The implement of English documentation may be slower, and it may lack in detail compared with the Chinese documentation. Translation pull-requests are welcomed.

Sample

The setting configuration in this repo is a good example, you can implement yours according to the format. [1]

Generate with Parameter

One method of the generate function allows three parameters:

  • srcdir: dir containing raw data (markdown, etc)

  • tardir: dir to store result (html, etc)

  • pss: instance of PagesSetting

PagesSetting constructor uses keywords. These are just introductions, please refer to the source code for details.

key namedescription
buildmessagebuild message
charsetcharset of source files
default_altdefault alt for images
favicon_pathpath of favicon, use "" if none
filesuffixsuffix of generated files
giscusGiscus setting
langlanguage(en, zh, etc)
logo_pathpath of logo, use "" if none
main_scriptsetting for main.js
make404whether to create a 404-page
make_indexwhether to create index pages
page_foothtml inserted at the bottom
parserCommonMark parser
remove_originwhether to remove before generating
repo_branchdefault branch name of repo
repo_namename of repo
repo_ownerowner name of repo
repo_pathfull path to repo default branch
src_assetsrefer to guidelines
src_scriptrefer to guidelines
table_aligntable align setting
tar_assetsname of dir of generated assets
tar_cssname of dir of generated css files
tar_extraname of dir of generated extra data
tar_scriptname of dir of generated scripts
throwallwhether to throw non-fatal errors
titletitle
unfoundpage to redirect when 404 error occurs (page will be automatically generated if not found)
wrap_htmlwhether to wrap html files
  1. title is the only key without default value.

  2. File that value unfound refer to shall be under the same directory.

  3. Values of keys starting with src_ or tar_ shall only be a dir-name without /(dir-split symbol)

  4. If source data is in a repository, you should remember to set repo_name and repo_owner

Config File

The third parameter of the other method is a string, representing the path to the config file, and defaults to DoctreeBuild.toml.

The config file uses TOML format, where

  • version represents the lowest supported DoctreePages version, more complicated setting like this is supported after v1.3

  • pages, giscus and mainscript represents Pages-setting, Giscus-setting and MainScript-Setting

  • despite strings and booleans, no advanced function is provided

Github Action

You can use github action to build pages into github pages. View sample builddocs.yml

You can use template() to generate a template for document automatic building in the current directory.

Builder Script

If you want, you can also call the provided functions and write a builder script yourself.

  • 1

    Note that you should replace the two lines before using DoctreePages with Pkg.add(name = "DoctreePages").