Our first project¶
In this tutorial we create, write, and build our first documentation project with Guidedog. The goal is modest and clear. We start from an empty directory. We make an HTML website and a printable PDF book from the same source file. Then we try the live preview server.
We need a working installation of Guidedog. For PDF output, Guidedog can use its embedded compiler or an installed Typst binary (0.15.1). See Build and install Guidedog.
On macOS, we can install the official release with Homebrew:
brew install insanai/guidedog/guidedog
Elsewhere, we build it from a source checkout with the Rust toolchain, and put
target/release/guidedog on our PATH:
cargo build --release -p guidedog-cmd
target/release/guidedog --version
Project architecture and build pipeline¶
Guidedog takes one directory of source files and compiles it into two outputs: a responsive HTML website and a typeset PDF book.
1. Create the project¶
We run the quickstart command from a folder where the directory notes does
not yet exist:
guidedog quickstart notes -q -p "Field Notes" -a "Your name" -v 1.0
Guidedog creates a complete, self-contained project:
notes/
.gitignore
conf.toml
index.rst
_templates/
layout.html
book.typ
discussion.typ
article.typ
theme.typ
_static/
guidedog.css
guidedog.js
typography.js
assets/
images/README.txt
audio/README.txt
video/README.txt
The files are:
.gitignore: Ignores_build/so generated files stay out of version control.conf.toml: Project settings (title, author, version, language, builders).index.rst: The root document. It defines our front page and table of contents._templates/layout.html: The HTML website template (Jinja)._templates/book.typ,discussion.typ,article.typ, andtheme.typ: The PDF book, discussion, standalone article, and shared typography templates (Typst)._static/: Editable CSS stylesheets (guidedog.css) and JavaScript enhancements (guidedog.jsandtypography.js).assets/: Folders for project images, diagrams, audio, and video files.
Templates in Guidedog are ordinary files that we can see and edit. They live inside
our project, not in an external theme or a system cache. We can change
them at any time to adjust the design of our site and book.
The first build creates _build for generated output.
2. Write the first page¶
We open notes/index.rst in an editor and replace its contents with the following:
Field Notes
===========
A clear explanation begins with a simple example.
Measuring a square
------------------
If the side has length :math:`s`, its area is :math:`s^2`.
.. math::
A = s^2
.. note::
State the measurement units before comparing calculations.
This page shows headings, mathematical notation, and a note.
3. Build and inspect the outputs¶
We compile our project into both HTML and PDF:
guidedog build html notes -W
guidedog build pdf notes -W
The -W flag tells Guidedog to treat warnings as errors. With this flag in
our routine checks, broken references and markup errors are caught early.
Now we inspect the output files:
- We open
notes/_build/html/index.htmlin a web browser. We see a clean, responsive documentation website with a theme switch, search bar, and formatted math. - We open the PDF file in
notes/_build/pdf/. We see a book layout with running headers, page numbers, and typeset math.
Guidedog formats mathematics for each medium. The browser gets MathJax, and the PDF gets Typst’s own vector formulas.
4. Live preview and incremental rebuilds¶
Guidedog includes a built-in development web server:
guidedog serve notes
The terminal prints a local URL, such as http://localhost:8000. We open this address in
a browser.
Now we test the live editing loop:
- Edit
notes/index.rstto add a new paragraph. - Save the file.
- Refresh the browser page.
Before serving a requested page, Guidedog checks the project’s inputs (sources, templates, static files and configuration) against its saved build environment. If an input has changed, it rebuilds only the affected documents before it answers the browser request. A failed rebuild keeps the previous site and reports the problem in the terminal.
When we run a build without changing any files, Guidedog reuses the saved document trees and parses nothing again. See How a project works for how it decides.
We press Ctrl+C in the terminal to stop the server when we are done.
Next, Make a small book shows how to organize several chapters and cross-references.