Commands

The program flight-manual has these commands.

build

flight-manual build ?-site FILE? ?-root DIR? ?-strict? ?-watch? OUT

Builds the site of the site file FILE into the folder OUT. With no -site, the site file is site.fm in the current folder. -root names the source folder: the folder of the pages and the assets. The default is the folder of the site file. The site file says which path is relative to which folder.

The build:

  1. Reads the site file (The site file) and the list of pages.
  2. Runs the plugins of the site (Plugins), and reads each page with ztcl::markdown, with the GitHub extensions: tables, task lists, strike text, and autolinks. Raw HTML in a page goes out as text, or as HTML with html keep in the site file (with no tag filter).
  3. Gives each heading an anchor (id) from its text.
  4. Adds the highlight of code, the admonitions, and the boxes of tables (Templates).
  5. Writes each page as PATH/index.html of OUT, or as PATH for a page path that ends with .html, through the page template of the style (Templates).
  6. Writes the search page search/, the index search.json, and the script assets/search.js (Search).
  7. Writes sitemap.xml with the URL of each page, and llms.txt and llms-full.txt when the site file has a summary.
  8. Copies the files of the style to OUT/assets/, and the files of the key assets.

A link of a page goes to one of these targets:

Link The link in the output
A Markdown file of the list of pages, with an optional #anchor The relative link to its page.
#anchor The anchor of the same page.
A file that the build copies The relative link to the copy.
A URL of the site (it starts with the key url) The relative link to its page or file.
A file of the source folder that is not part of the site, with the key repo The page of the file in the repository.
A URL with a scheme, such as https:, or a link that starts with / The same link.

Each other link is an error. A link to an anchor that the page does not have is an error. The build gives each fault of each page, and then stops with the exit code 1. It writes no file when it finds a fault.

The build also checks the alternative text of each picture, the levels of the headings, and the contrast of the colors of the style (The checks). A fault of these checks is a warning on the standard error, and -strict makes it an error.

The build makes the folder OUT and its parents when they do not exist. It writes over the files of OUT, and it removes no file.

Exit code Meaning
0 The site is built.
1 The site has a fault, or a warning with -strict. Each line of the error names the file and the fault.
2 The command line has a fault, or the site file does not exist.

Examples:

$ flight-manual build _site
built 4 pages into _site
$ flight-manual build -strict -site examples/basic/site.fm _site
built 4 pages into _site
$ flight-manual build -site sites/ztcl/site.fm -root ../ztcl _ztcl
built 967 pages into _ztcl

The third command reads the site file of sites/ztcl/ and the pages of a checkout of ztcl in ../ztcl.

build -watch

With -watch, the build stays on after the first build. Each 300 ms it reads the time and the size of each file that the last build read: the site file, the list of pages, each page, each template and style sheet, each plugin, and each asset. When one changes, or a file of a folder of the site comes or goes, it builds the whole site again and writes it into OUT. It prints one line for each build, with the time and the warnings. A build with a fault prints the fault and keeps the files of the last good build. Stop it with Ctrl-C.

$ flight-manual build -watch _site
built 29 pages into _site
watching the files of the site: stop with Ctrl-C
built 29 pages into _site in 130 ms

serve

flight-manual serve ?-site FILE? ?-root DIR? ?-port N? ?-no-watch?

Builds the site in memory, with no output folder, and serves it on http://127.0.0.1:N/. The port is 8000 by default, and -port 0 takes a free port. The server answers only on the loopback address, and only with the files of the build: a path outside the site is "404 Not Found". -site and -root are the same as for build.

serve watches the files of the site, as build -watch does. After each build, the page in the browser loads again: serve adds a small script to each page that it sends, and the script asks the server each second for the number of the build. The files of build never have this script. A build with a fault keeps the last good build, and each page shows the fault in a box at its bottom. -no-watch serves the first build with no script and no watch.

$ flight-manual serve
built 29 pages in 203 ms
serving http://127.0.0.1:8000/ : stop with Ctrl-C
built 29 pages in 123 ms

The plugins of a site get nothing more with serve than with build: the server is part of the program, and a plugin has no socket.

Exit code Meaning
1 The first build has a fault, or the port is not free.
2 The command line has a fault, or the site file does not exist.

version

flight-manual version

Prints the version, such as flight-manual 0.1.0. --version is the same command.

help

flight-manual help

Prints the usage. -h and --help are the same command.

check

flight-manual check ?-site FILE? ?-root DIR? ?-strict?

Runs the build in memory, with each check of The checks, and writes no file. It prints each warning with its file, and with its line for a Markdown page, and then the count. -site and -root are the same as for build.

$ flight-manual check
flight-manual: warning: docs/index.md:5: the heading h3 "Deep" skips a level after h1
checked 4 pages: 1 warning
Exit code Meaning
0 No error, and no warning with -strict.
1 The site has a fault, or a warning with -strict.
2 The command line has a fault, or the site file does not exist.

Next: The site file.