Output #

View this page as Markdown

On this page

This page lists what a build writes: the page tree, the copied files, the page head, the callouts, diagrams, and pager and the On this page list, and the styling names. It also covers a site of several products, the machine files, the 404 page, and the redirect stubs. It says what a failed replacement leaves behind, and it lists every name in the generated HTML and the stylesheet.

After a build, the output folder contains each page at <slug>/index.html and the root page at index.html (The tree). Serve it with a static server, because a browser that opens the files from disk displays only the first page you open correctly. A build replaces the whole output folder only after it has generated the new site (Publication and recovery).

This reference describes the renderer used on the Turn Zero website. For the difference from the npm package tzdocs 0.13.0, see Website and npm versions.

The tree #

The build writes each page to <slug>/index.html inside the output folder, the root page as index.html. Pages share docs.css and, when the build was given --stylesheet, site.css. Each page includes the full navigation with the current page marked. On a window wider than 800 pixels, the navigation stays in view while the article scrolls. If it is taller than the window, it scrolls on its own, and its scrollbar shows only while the pointer or the focus is in it.

In a single-folder build, the stylesheet, navigation and redirect links are relative, so the tree works under any base path on a static server. In a site of several products, sidebar links to pages in other products start at the site’s root (The sidebar). Each page or redirect link ends in a folder slash, such as ../guides/, and the server returns that folder’s index.html.

A browser that opens the tree from disk shows the folder instead, so only the first page opened from disk displays correctly. The tool does not rewrite the links a shell supplies, so the shell's author must keep them correct. Nor does it rewrite the link address and the search address a config file names, which it writes as given.

Every other file in the source folder, an image or a download for example, is copied byte for byte to the same path in the tree. A file in a folder whose name begins with a dot, or whose own name begins with one, is not copied. Nor is a file that only hidden pages reference, unless the build passes --include-hidden. A page's images and file links are rewritten to the copied file's address relative to the page. Images and other files gives the rules.

The root names docs.css, site.css, docs.json, llms.txt, llms-full.txt, sitemap.xml, 404.html, and mermaid.min.js are reserved for the build's own files, so no page and no copied file can take one.

A built tree has this shape.

site/
  index.html
  index.md
  docs.css
  site.css          where --stylesheet named one
  docs.json
  llms.txt
  llms-full.txt
  sitemap.xml       where --origin named one
  404.html
  mermaid.min.js    where a page draws a diagram
  getting-started/
    index.html
    index.md
  guides/
    diagram.png       a copied file, at its source path
    code-blocks/
      index.html
      index.md
  old-slug/
    index.html        a redirect stub
    index.md          the stub's Markdown pointer

Each page carries one short inline script. It places the copy control on code blocks, a button with two icons at each block's right, which copies the block's text as authored. It also places a Wrap lines box on a block whose lines are too long for it. On a page that draws a diagram, it also starts Mermaid from the tree's own mermaid.min.js, which that page alone loads (Diagrams).

On a screen 800 pixels wide or less, Browse docs opens the full navigation and search above the article. It starts closed on each new page, so the article is visible on arrival; links to sections keep their destination. The button stays in view while scrolling. Escape within the navigation closes it and returns focus to the button. Without scripting, the full navigation stays visible and no disclosure button appears. On a site with search configured, the script also runs the search box. Your own shell or raw HTML may include additional scripts.

Text in Markdown-only sections stays in index.md and is omitted from HTML. It also stays in llms-full.txt unless the build excludes that page from the full text. The manifest lists rendered headings only; its code-block inventory includes marked blocks too.

The page head #

Each page's head names the page and the corpus it belongs to. The <title> element contains the page's title, a spaced em dash, and the home page's title, such as Add a page — Turn Zero Docs. The home page's title already names the corpus, so the home page carries its title once. In a corpus without a home page, each page carries its own title alone. The navigation, the index, and the manifest keep the page's own title.

The head also carries the share tags that a chat app or a social site reads when someone shares a link to the page:

Tag Value
<meta name="description"> The page's description.
<link rel="canonical"> The origin given with --origin, followed by the page's route, such as https://example.com/docs/guides/add-a-page/. Present only with --origin.
og:title, twitter:title The same text as the <title> element.
og:description, twitter:description The page's description. Absent where the description is empty.
og:url The same address as the canonical link. Present only with --origin.

The canonical link, og:url, and the sitemap are the only absolute addresses the tool writes. Give the origin of the site that search engines should list. Then a tree served at more than one address names the same page as canonical in every copy. The share tags that every page has in common, such as the site's name, its share image, and the card form, belong to your site: put them in the head of your shell.

Publication and recovery #

The build checks the source and the output folder before it writes anything. It generates the whole site in a temporary staging folder beside the output folder, named .tzdocs-stage-*. A validation, rendering, or staging-write failure leaves the previous output unchanged.

After generation succeeds, the build replaces the output folder in these steps:

  1. It renames an existing output folder into a .tzdocs-backup-* folder beside it.
  2. It renames the generated tree to the output path.
  3. If that rename fails, it renames the previous output back. If that fails too, the error message says where the previous output remains, inside the backup folder. Do not delete that folder before you recover the output from it.
  4. After a successful replacement, it removes the backup. If that cleanup fails, the error message says that the new site is published and gives the remaining backup folder.

After a nonzero exit, read the message: the output may have changed. Refusals and findings gives the messages.

The replacement is not atomic. A crash or a concurrent change to the file system during it can require manual restoration or cleanup. Run one build at a time into a given output folder, and deploy only after you inspect a successful result. A missing or unreadable source file can produce a Node.js error rather than a formatted finding.

Callouts, diagrams, and the pager #

Callouts #

A block quote that opens with one of the five callout markers (Page source) becomes a div classed docs-callout. Its data-callout attribute holds the type, such as note. Its first child is a p classed docs-callout-title holding the title, such as Note, and the rest of the quote follows.

<div class="docs-callout" data-callout="warning">
<p class="docs-callout-title">Warning</p>
<p>The build replaces the whole output folder.</p>
</div>

Diagrams #

If Mermaid is installed and the build does not pass --diagrams-as-code, a mermaid fence becomes a div classed docs-diagram. It holds the diagram's source, escaped, with its line breaks kept. The build copies Mermaid's browser file, byte for byte, to mermaid.min.js at the tree root. Each page holding a diagram loads it with one deferred script tag in its head.

Once the page has loaded, its inline script draws each diagram as an SVG image. Under a dark prefers-color-scheme it uses Mermaid's dark theme. The div is not a pre, so a diagram has no copy control.

Otherwise the fence renders as a code block in the language mermaid, no page loads a script file, and the tree holds no mermaid.min.js. Which file the build found, and its version, are inputs of the build like the source files.

Next and previous #

With --next-previous, each page's last element in the docs-main column is the pager. It is a nav classed docs-pager, labelled aria-label="Previous and next pages". It contains a link to the previous page and a link to the next one, in the navigation order the manifest and the whole text follow. The first page has no previous link and the last page no next link. A corpus of one page has no pager.

<nav class="docs-pager" aria-label="Previous and next pages">
<a class="docs-pager-prev" rel="prev" href="../"><span>Previous</span>Home</a>
<a class="docs-pager-next" rel="next" href="../guides/add-a-page/"><span>Next</span>Add a page</a>
</nav>

The links are classed docs-pager-prev and docs-pager-next and carry rel="prev" and rel="next". A section in the navigation that opens and closes is no page, so the pager never links one. Hidden pages are linked only when the build passes --include-hidden. Without --next-previous, no page carries the pager.

On this page #

A page with at least two rendered second- or third-level headings lists them under On this page, in source order. Each entry links to the heading's own anchor. Third-level headings nest under the preceding second-level heading; those before the first second-level heading stay at the top level. Headings in Markdown-only sections and a home page's opening are excluded. A page whose front matter sets toc_max_heading_level: 2 lists its second-level headings alone, and needs two of them for the list to appear.

A list of more than 20 entries groups each second-level heading that has headings under it with those headings, in a group that starts closed, opens on a tap, and links the heading first.

As the reader scrolls or follows an entry, the page's script marks the entry for the section being read, in both forms, with aria-current="location". The stylesheet shows that entry in the link color, bold and underlined, and shows a closed group's summary in the link color while the group holds it.

Following an entry, arriving at a heading's address, or going Back or Forward marks that heading at once. As the page scrolls, the mark goes to the last listed heading that has scrolled up to where following its entry places it. That place allows for a site's fixed header through the heading's scroll-margin-top. Once the page is scrolled to its end, the last heading is marked. Above the first listed heading, and without scripting, no entry is marked. The mark never moves focus or changes the address.

The list has two forms, with only one displayed at a time. At a docs-shell width of at least 80rem, a nav classed docs-toc stands beside the article, after docs-main. Below that width, a details element classed docs-toc-details starts collapsed beneath the page's Markdown link. Where that link is absent, the list uses the position the link would have occupied.

Each form contains a nav labelled aria-label="On this page"; its visible label is classed docs-toc-label. The docs-shell wrapper is an inline-size container named docs-shell, so its available width determines the form even inside a narrower site shell. Browsers without container queries keep the collapsed form.

The styling surface #

docs.css is a complete stylesheet for layout, typography, navigation, code blocks, callouts, diagrams, the pager and the On this page list. It declares twenty-five color properties and one width property. On a narrow screen, the page stays within the screen's width: a long word in the text wraps, a file path in inline code included, and a wide table scrolls sideways inside itself. A site restyles the tree with a site stylesheet or with a shell's own stylesheet, and both target the names below. Style the site is the guide for the stylesheet and for the shell.

The colors #

Twenty-five of the custom properties are colors, declared on the .docs-shell element. Each has a light default and, for all but the code block's own and token properties, a dark default under the viewer's prefers-color-scheme. A site redefines them on that element. A value declared on :root, html, or body is inherited and loses to the tool's own declaration.

Property Role
--docs-bg page background
--docs-text body text
--docs-muted secondary text, section names, captions
--docs-nav-text navigation links
--docs-link links, the current page, the emphasized line's bar
--docs-border rules and table borders
--docs-code-bg inline code background
--docs-pre-bg code block background
--docs-pre-text code block text
--docs-quote block quotes
--docs-tok-comment code tokens: comments and quotes
--docs-tok-keyword code tokens: keywords, literals, selector tags, template tags, doc tags
--docs-tok-string code tokens: strings, regular expressions, additions
--docs-tok-number code tokens: numbers, symbols, bullets
--docs-tok-title code tokens: function and class names, sections, tag names, selectors
--docs-tok-attr code tokens: attributes, variables, properties
--docs-tok-type code tokens: types, built-ins, pseudo selectors
--docs-tok-meta code tokens: meta lines and their keywords
--docs-tok-deletion code tokens: deletions in a diff
--docs-code-hl the emphasized line's band
--docs-callout-note a Note callout's bar and title
--docs-callout-tip a Tip callout's bar and title
--docs-callout-important an Important callout's bar and title
--docs-callout-warning a Warning callout's bar and title
--docs-callout-caution a Caution callout's bar and title

The code block keeps one dark background under both schemes, so its own and the token properties are declared once and their light and dark defaults are the same. The example below is a complete restyle, and the tool's own test suite builds with this exact text:

.docs-shell {
  --docs-bg: #0b1020;
  --docs-text: #e6edf6;
  --docs-link: #7cc4ff;
  --docs-pre-bg: #05080f;
}
.docs-main pre code .docs-line-hl {
  background: rgba(124, 196, 255, 0.12);
}

The navigation width #

The navigation column takes its width from --docs-nav-width, also declared on the .docs-shell element. Its default is 17rem, the same under both color schemes. A site whose navigation titles wrap can widen the column by redefining it there. On a narrow screen, the navigation sits above the article at the full width, whatever the property says.

.docs-shell {
  --docs-nav-width: 20rem;
}

The selectors and the names #

A site rule that uses the tool's own selector wins, because the site's stylesheet comes later. A rule of lower specificity than the tool's does not win, whatever the link order. The parts, with the selector to write and the names the markup uses:

Part Selector to write Names
the wrapper .docs-shell docs-shell
the navigation .docs-nav, .docs-nav a, .docs-nav a[aria-current="page"] docs-nav, aria-current="page", aria-label="Documentation"
a section's name, which opens and closes it .docs-nav-section, .docs-nav details[open] > .docs-nav-section::after docs-nav-section
the article column .docs-main, .docs-main h1, .docs-main h2, .docs-main h3, .docs-main p, .docs-main a, .docs-main code, .docs-main table, .docs-main blockquote docs-main
a heading's anchor link .docs-main .docs-anchor, .docs-main :hover > .docs-anchor, .docs-main .docs-anchor:focus-visible, .docs-main .docs-anchor:hover docs-anchor
the page's Markdown link .docs-main .docs-source docs-source
a code block .docs-main .docs-code, .docs-main .docs-code figcaption, .docs-main pre, .docs-main pre code docs-code, data-language, the language-* class
a line, an emphasized line .docs-main pre code .docs-line, .docs-main pre code .docs-line-hl docs-line, docs-line-hl
a numbered block, a line's number .docs-main .docs-numbered pre code, .docs-main .docs-numbered pre code .docs-line, .docs-main .docs-numbered pre code .docs-line::before docs-numbered
the copy control and its status .docs-main pre .docs-copy, .docs-main pre .docs-copy:hover, .docs-copy-status docs-copy, docs-copy-icon, docs-copied-icon, docs-copy-status, data-copied, data-copy
the Wrap lines box, a block that shows it, wrapped lines .docs-main pre .docs-wrap, .docs-main pre .docs-wrap::after, .docs-main pre.docs-wrap-shown, .docs-main pre.docs-wrapped-lines code .docs-line docs-wrap, docs-wrap-shown, docs-wrapped-lines
a callout .docs-main .docs-callout, .docs-main .docs-callout-title, .docs-main .docs-callout[data-callout="note"], .docs-main .docs-callout[data-callout="note"] .docs-callout-title, and the same two for tip, important, warning, and caution docs-callout, docs-callout-title, data-callout
a diagram, a drawn diagram .docs-main .docs-diagram, .docs-main .docs-diagram[data-processed] docs-diagram, data-processed
the pager .docs-main .docs-pager, .docs-main .docs-pager a, .docs-main .docs-pager a span, .docs-main .docs-pager-next docs-pager, docs-pager-prev, docs-pager-next, aria-label="Previous and next pages", rel="prev", rel="next"
the On this page list .docs-toc, .docs-toc-label, .docs-toc a, .docs-main .docs-toc-details, .docs-main .docs-toc-details a, .docs-toc a[aria-current="location"], .docs-main .docs-toc-details a[aria-current="location"] docs-toc, docs-toc-label, docs-toc-details, aria-label="On this page", aria-current="location"
the default layout's body .tzdoc-page tzdoc-page
the mobile navigation control .docs-browse, .docs-browse::after, .docs-browse:focus-visible, .docs-browse[aria-expanded="true"]::after, .docs-browse[hidden], .docs-nav[hidden] docs-browse, aria-controls="docs-navigation", aria-expanded="false", hidden

The markup is the same on every page:

  • The docs-shell wrapper contains the docs-nav navigation, the docs-main article column, and the On this page rail where the page has a list.
  • Before the navigation stands a button classed docs-browse, labelled Browse docs. Its aria-controls names the navigation's docs-navigation ID, and aria-expanded states whether it is open. The script uses hidden for the closed navigation and for the button on desktop. Breakpoint changes move focus out of anything being hidden. A site with a fixed header sets the button's top offset in its stylesheet so the header does not cover it.
  • The navigation is a nav element containing a ul of li elements. Each li contains an a, or, for a section with other entries, a details element. Its summary is classed docs-nav-section and contains the section's title, and its ul lists the entries. The details element is open on the pages the section contains and closed elsewhere, and the summary's ::after draws the chevron.
  • Each rendered heading ends with an a classed docs-anchor that shows #, targets the heading's own anchor, and uses Link to followed by the heading's plain text as its accessible name.
  • The anchor link is hidden until a reader points at its heading or moves keyboard focus to the link. It keeps its place after the heading's text while hidden, so the heading does not shift when it appears.
  • Beneath the first first-level heading of the page's content, or at its top where it has none, a p classed docs-source links to index.md, the Markdown source the build writes beside the page. When the first top-level first-level heading is Markdown-only, this link is omitted with it.
  • A code block is a figure classed docs-code. It has data-language where the fence's language word is a name, and a figcaption where a title was given.
  • Inside the figure are a pre and a code element, classed language-* where the fence's language word is a name, with one docs-line span per line.
  • A figure whose fence carries showLineNumbers is also classed docs-numbered. The stylesheet numbers its docs-line spans with a CSS counter, in a muted gutter that selection skips. The numbers are not part of the text, so the copy control copies the block without them.
  • The copy control is a button classed docs-copy, placed inside each pre, with two icons and a data-copied state. A fence's copy= words appear on pre as data-copy. The script sets aria-label to “Copy” followed by those words when present. Otherwise the label is “Copy”. Every page with copy controls has one visually hidden p.docs-copy-status with role="status". It announces “Copied to clipboard.” or “Couldn’t copy. Select the text and copy it manually.” Focus stays on the button.
  • Where a line of a block is too long for its width, the script shows a label classed docs-wrap at the block's top left, holding a checkbox named Wrap lines. It classes the pre docs-wrap-shown, so the code starts below the box. Unticked, the long line keeps its ellipsis. Ticked, the pre is also classed docs-wrapped-lines and every line shows whole. The script reads the widths again when the window's width changes, and the copy control copies the same text either way.
  • A callout, a diagram, and the pager have the markup Callouts, diagrams, and the pager gives.
  • The On this page list has the two forms On this page describes.

The token classes, such as hljs-keyword and hljs-string, are the highlighter's class names at its pinned version. The highlighter adds a second class after some of them, such as function_. A site colors tokens through the token properties rather than by class.

A copied stylesheet's own relative references, such as url(...), resolve from the tree root. The body rules (the margin reset, the font stack, and the color scheme) target the default layout's body class, tzdoc-page, and never a shell's body. A site's own base typography is therefore untouched.

A site of several products #

A build whose config file names products writes one tree per product, each in the output folder at the product's base, such as site/cloud/ and site/tracker/ (Build one site for several products). Each tree is the tree a build of that product's folder alone writes under that base. It has the same pages, Markdown copies, redirect stubs, copied files, machine files, sitemap, and 404 page. Three things differ:

  • Every page carries the site's sidebar in place of its own tree's navigation. A product's opening stands at the head of its own home page, and --shell, where given, wraps every page of every product.
  • Each tree's docs.css carries the site's rules after the tool's own.
  • Where the site names a search address, the page's one script also runs the search box.

A build of a single folder writes none of these, so its output is unchanged.

Where the site names a home, the build writes one more file: index.html at the home's address, such as site/docs/index.html. It opens the first page of the first product that is not gated at once, keeping any # part of the address, and has no heading or cards of its own. Its title is that page's title, and, given --origin, its canonical link names that page.

site/
  docs/
    index.html        the docs home, where the config file names one
  cloud/
    index.html
    docs.css
    docs.json
    llms.txt
    llms-full.txt
    getting-started/
      index.html
      index.md
  tracker/
    ...

The sidebar #

The sidebar is the same nav element, classed docs-nav, on every page of every product. From the top:

  • Where the site names a link, an a classed docs-nav-link, holding the link's title in a b element and its text after it. Its address is written as the config file gives it.
  • Where the site names a search address, a form classed docs-search, with role="search", holding one search input with the label aria-label="Search all docs". Under it stands an empty div classed docs-search-results, where the hits appear. The form's data-search holds the search address as the config file gives it, and its data-products holds each product's heading by its tree word, as JSON. Its data-parameter, and the input's name, hold the name of the search's query parameter: the config file's searchParameter, or q. If the site sets searchMaxLength, the input also has a maxlength attribute with that value.
  • A ul with one li per product, in the config file's order. Each holds a details element whose summary is classed docs-nav-product. Its ul holds the product's whole navigation, the same items a build of that folder alone writes. Where the product's sidebarHome is false, the list leaves out its home page's link and starts with its sections and pages.

With a product description, its summary shows its name, then the description in a span classed docs-nav-product-description. The description appears beneath the name in smaller, muted text. Its heading in data-products is its name alone. Without a description, both its summary and that heading show the label followed by the name in parentheses, such as Backend & Hosting (Turn Zero Cloud).

A gated product, on any page but its own, has no entry. In its place the list holds a marker on a line of its own: the comment <!--docs-product:<tree>-->, with the product's tree word. The page names the product nowhere else, and its heading is left out of data-products. On its own pages, a gated product stands as any product does.

The product of the current page is open, with its sections and the current page marked as in a single folder’s navigation. Every other product is closed, with all its sections closed and no page marked. Sidebar links within the current product stay relative to the current page. Links to other products start at the site’s root, with the product’s base followed by the page’s slug. For example, base /tztrack and slug /guides/raise give /tztrack/guides/raise/.

The site's rules style these names with the tool's colors, so the custom properties retune them too. The names are docs-nav-link, docs-search, docs-search-results, docs-nav-product, and docs-nav-product-description, and the attributes role="search", aria-label="Search all docs", data-search, data-parameter, and data-products. A site stylesheet that styles them writes a selector that starts with .docs-nav, so that it wins over the tool's navigation rules.

The box does not search by itself: it asks the search address the site names. Add search to your docs shows how to write the service at that address. The reader types two characters or more and pauses. The page then sends a GET request to the address with the words as the q parameter, such as /api/v1/docs/search?q=deploy+app. Where the config file names a searchParameter, such as query, the words go in that parameter instead: /api/v1/docs/search?query=deploy+app. Pressing Enter sends nothing.

The answer is JSON: a list of hits, or an object holding the list as hits or results. The box reads these members of each hit:

Member What the box does with it
tree Shows the product's heading, found by this word, above the hit. A word the site does not know is shown as it is.
title Shows it as the hit's title.
route Links the hit to it. It must start with one / and stay on the same host when the browser reads it. A hit with any other route is left out, such as one whose backslash, tab, or line break the browser reads as a second /.
heading Shows it after the title, as Title › Heading, where it differs from the title. Optional.
anchor Adds # and the anchor to the link, so the hit opens at its section. Optional.
excerpt Shows it under the title. Optional.

The box shows up to eight hits, in the order of the answer, each as a link holding a small, a b, and a span. It sets every text as plain text, so markup in an answer shows as written. When the reader changes the search words, the box clears the previous hits immediately. It ignores responses to earlier searches. Instead of hits, the box can show one of two lines:

  • With no hits: No pages match.
  • When the request fails: Search is not available right now.

Machine files #

Every build writes four kinds of file for scripts and AI assistants. Start with llms.txt, the index: one line per page with its title, route, and description. Read docs.json to find headings and sections, then read only the relevant Markdown copies. Read llms-full.txt when the combined text is useful, checking in_full_text in the manifest for any pages excluded from it.

The index #

llms.txt at the tree root contains, in this order:

  • a first-level heading with the home page's title;
  • a block quote with the home page's description, where it has one;
  • a Start here heading listing the home page and the root's own pages;
  • one heading per top-level section, listing the pages that --full-text-exclude does not leave out, and no heading for a section whose every page is excluded;
  • a final Optional heading listing the pages that --full-text-exclude left out of the whole text.

Every page line has the form - [title](route): description, without the colon and the description where the description is empty. For a corpus without a home page, the index's first-level heading is Documentation. The index reserves the Start here and Optional headings for itself (Source-level refusals).

The index of a corpus built with --base /docs has this form.

# Turn Zero Docs

> One command turns a folder of Markdown files into a static documentation site.

## Start here

- [Turn Zero Docs](/docs/): One command turns a folder of Markdown files into a static documentation site.

## Getting started

- [Getting started](/docs/getting-started/): Install the published tzdocs package, check a folder of Markdown, and build the site.

## Optional

The manifest #

docs.json at the tree root lists every page in navigation order:

Member Contains
base The base path.
version The corpus version, present only where --corpus-version gave one.
pages[].route The page's route.
pages[].title The page's title.
pages[].description The page's description.
pages[].section The section word: the word the page's section key declares, or else the page's first path segment, its own slug word at the root, and home for the home page.
pages[].in_full_text Whether the page is in the whole text.
pages[].headings Each heading's depth, text, and anchor.
pages[].code_blocks Each fenced code block on the page, in order: its language, its title, and its number of lines. Each of the first two is null where the fence gives none, and language also where its word is not a name. A mermaid block is listed, and an indented block is not. The list is empty where the page has none.
moved[].from A route a page's redirects_from names, under the base path. The list is empty where no page moved.
moved[].to The route of the page that names it.

The manifest has this form.

{
  "base": "/docs",
  "version": "0.2.0",
  "pages": [
    {
      "route": "/docs/",
      "title": "Turn Zero Docs",
      "description": "One command turns a folder of Markdown files into a static documentation site.",
      "section": "home",
      "in_full_text": true,
      "headings": [
        { "depth": 1, "text": "Turn Zero Docs", "anchor": "turn-zero-docs" },
        { "depth": 2, "text": "Start here", "anchor": "start-here" }
      ],
      "code_blocks": [
        { "language": "text", "title": null, "lines": 3 }
      ]
    }
  ],
  "moved": [
    { "from": "/docs/output/", "to": "/docs/reference/output/" }
  ]
}

The Markdown copy #

<slug>/index.md beside every page contains the page's source Markdown, front matter included, line endings normalized, its links and images to pages and files written as addresses under the base path. Two forms keep the source's address: a link whose text runs across quoted lines, and one whose text holds an escaped | in a table. An agent that needs the source text rather than the rendered HTML reads this file.

The whole text #

llms-full.txt at the tree root contains every page's Markdown copy, its links written as there, joined in navigation order. Each copy follows an HTML comment giving its route under the base path. The pages under the slug prefix given to --full-text-exclude are left out. They stay pages, with their Markdown copies and their manifest rows, and appear under the index's Optional heading.

Each entry has this form.

<!-- /docs/ -->
---
title: Turn Zero Docs
...

The tool writes the index, the manifest, and the whole text at the tree root and nowhere else. It does not write an llms.txt at the site's root. If several documentation trees share one site, the site's owner writes the root index that lists them.

Which pages these files include follows the page's visibility and the --include-hidden flag (Add a page, step 4).

The sitemap #

With --origin, the build also writes sitemap.xml at the tree root, for search engines. It lists one <loc> per built page, in navigation order: the origin followed by the page's route under the base path. It lists no redirect stub and carries no lastmod date, since the output carries no timestamp. Without --origin the build writes no sitemap, because a sitemap must give absolute addresses.

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url><loc>https://example.com/docs/</loc></url>
<url><loc>https://example.com/docs/getting-started/</loc></url>
</urlset>

The 404 page #

A build of one corpus writes 404.html at the output folder's root. A build of several products writes a separate 404.html under each product's base path. The page contains the heading Page not found, one sentence, and a link to the home page. It carries <meta name="robots" content="noindex"> and uses the shell if the build supplies one.

Turn Zero Cloud is the recommended host (Publish the site). For a static site holding the build's root 404.html, an unmatched GET or HEAD uses that file with HTTP 404. This applies to page paths and paths with a dot; a HEAD has no response body. Keep the file at the root when copying the build into client/.

GitHub Pages, Netlify and Cloudflare Pages show the generated 404.html for an address that matches no file.

When a host serves that page at any depth, its stylesheet links and its home link begin with the base path, such as /docs/docs.css. Unlike the relative links between HTML pages, these links must work when the host serves the 404 page at a missing address at any depth. The page carries no navigation, no pager, and no Markdown link, and it is no page of the corpus: the machine files and the sitemap do not list it. Publish the site is the guide.

Redirect stubs #

Each redirects_from entry produces <old-slug>/index.html, a minimal page that redirects to the new slug by a relative path, preserving the section fragment such as #details. Without JavaScript, it refreshes to the new page; a link is also provided. With --origin, a stub also carries a canonical link to the new page's address.

Beside each stub, <old-slug>/index.md holds a short Markdown pointer naming the page and linking its new route and Markdown copy, so an old Markdown address still answers. Its links are written under the base path, and are root-relative without one. Stubs have no navigation and no shell, and no page entry in the machine files. docs.json lists each one under moved, so a script or an AI assistant reading the manifest reaches the new page without reading a stub.

Reproducible builds #

Building with identical sources, supplied files, options, Mermaid file, and tool version produces byte-identical output:

  • directory listings are sorted before they are read;
  • written paths use one separator on every platform;
  • input line endings are normalized at read;
  • heading anchors follow the tool's own anchor rule, duplicates suffixed -2, -3, and so on;
  • code tokens depend only on the block's text, its language, and the pinned highlighter version;
  • no timestamp is written anywhere.

A diff between two such builds shows content changes and nothing else. A change to the tool, its renderer, its highlighter, or the build options can also change the output.