How a build works
This page explains the steps of flight-manual build, from the site file to the output folder. Read it to know where a fault comes from, or before you write a plugin.
The steps
- Read the site file. The build checks each key and its value. An unknown key is an error.
- Make the list of pages. The list comes from the key
pages, from a file of pages, or from the Markdown files of the folderdocs. - Load the style and the plugins. Each plugin runs in its own safe child interpreter. The hook
pagesof each plugin can change the list of pages. - Name each output. The build gives each page its path and records each file that it will copy or write. Two outputs with the same path are an error. With this record, a link can go to a file that the build writes later, such as
sitemap.xml. - Check the page template against the rules of Styles and templates.
- Make each page.
- The hook
sourcechanges the Markdown. ztcl::markdownmakes the HTML. For each link, code block, and heading, it calls the build: the build resolves the link, highlights the code, and records the anchor and the table of contents.- The build adds the scope of the table heads, the box of a wide table, and the notes.
- The hook
htmlchanges the HTML. - The checks of the alternative text and the headings run.
- The hook
- Check each anchor. A link to an anchor of another page is checked after all pages are made.
- Fill the template of each page: the menu, the table of contents, the links to the previous and the next page, and the search box.
- Write the other files: the search page and
search.json,sitemap.xml,llms.txtandllms-full.txt(with the keysummary), and the files of the hookfiles. - Stop or write. If a step found an error, or a warning with
-strict, the build writes no file and prints each fault. Else it writes each file and copies each asset.
Why it works this way
- The checks come before the write. A build with a fault leaves the output folder as it was, so a deploy never gets half a site.
- The core does no I/O. The code of
lib/gets the files through a small interface and returns the files to write. The tests give it files in memory, so each test is fast and needs no folder. - The links are relative. A page links to
../install/, with a path from the page. The site works in each folder of a server and from the disk. - The same input gives the same output. The order of each list is fixed, and no step uses the clock or a random number. A change of the output comes from a change of the input.
Next: The ztcl docs site.