The commands
Each command takes the folder of the project, which holds _smalldocs.yml or _quarto.yml. If you give no folder, the
command uses the folder you are in.
render
smalldocs render [DIR] [--quiet] [--strict]render builds the site. With --quiet, it prints only warnings and errors. With --strict, a
warning makes the exit code 1. A broken link and an option that smalldocs ignores are warnings.
preview
smalldocs preview [DIR] [--port 4200] [--host 127.0.0.1] [--no-browser]preview builds the site, serves it and opens a browser. When a file of the project changes, it
builds the site again, and the browser loads the new pages. If a build fails, the command prints the
error and keeps the last good site. It listens on this computer only. To listen on other addresses, give --host.
check
smalldocs check [DIR]check builds the site into a temporary folder, and keeps your output folder as it is. It still
writes the API pages and runs the pre-render and post-render commands, as a build does. Then it
lists what to fix:
- the options that smalldocs ignores
- the broken links
- the Markdown that smalldocs does not read or does not run, with the file and the line of each. Examples are citations, cross-references, grid tables and code cells
If it finds anything, the exit code is 1.
api
smalldocs api build|check|list [--dir DIR] [--out NAME]
smalldocs api check --shown [--dir DIR] [--out NAME]
smalldocs api module NAME [--dir DIR] [--out NAME]api makes the reference pages, checks the docments, lists the documented names, or prints one module as
Markdown. With --shown, check looks only at what the pages show, and leaves out private names and
names outside __all__. See The API reference.
list and module are for Python only. For Rust, TypeScript and OpenAPI, api has build and check.
When api is a list of sections, --out NAME runs only the section whose out is NAME. See
Rust, TypeScript and HTTP references.
publish
smalldocs publish gh-pages [DIR] [--branch gh-pages] [--remote origin] [--no-render] [-m MESSAGE]publish builds the site and pushes it to the branch. It works in a temporary worktree, so your
files and your current branch do not change. Your git hooks do not run for the commit of the site.
It refuses some branches, because they hold your source files:
- your current branch
- the default branch of the remote
mainandmaster- a branch that shares history with your code and holds no site
With --no-render, the command publishes the output folder as it is.
add
smalldocs add SOURCE [--dir DIR] [--force]add copies the theme extensions of a git repository into the folder _extensions/ of the
project. SOURCE is org/repo on GitHub, org/repo@ref, a git URL, a local git repository, or a local
folder. It clones org/repo over ssh, so a private repository works with your own key. If an extension
is already there, the command asks before it replaces the extension. --force replaces it without a
question. See Themes.
themes
smalldocs themes [DIR]themes lists the bundled themes, and the extensions in _extensions/ with the source of each.
notebooks lint
smalldocs notebooks lint [DIR]notebooks lint lists the packages that each notebook imports. It checks them against the disallow
list, a list of packages that do not run in Pyodide, the Python that runs in the browser. A notebook
also fails lint when its kernel is not Python, or when it has no code cells. The command runs no
notebook code and needs no JupyterLite installation. It exits with code 1 if a notebook fails lint.
See Run notebooks in the browser.
Exit codes
| Code | Meaning |
|---|---|
| 0 | Done |
| 1 | Done, with something to fix: --strict with warnings, check and api check with findings, or notebooks lint with a notebook that fails |
| 2 | Stopped: no _smalldocs.yml or _quarto.yml, a bad option, a failed script, a port in use, or a failed clone |