Skip to content

Work through a tutorial outline

This page uses tutorial.leo as a small, repeatable example. The commands below run during the Zensical build, so the displayed outline is generated from the actual Leo file.

Inspect the outline

The compact inspector includes positions, GNXs, headlines, and bodies:

cub inspect tutorial.leo

This is useful when diagnosing an outline, but it is intentionally dense. For documentation, render only the hierarchy:

Render the hierarchy

cub render tutorial.leo

The outline renderer emits a nested Markdown list. A repeated vnode is shown as ↪ clone, so the Tasks entry under Reference makes the clone visible without duplicating its descendants.

Highlight a current section

Use an occurrence position to mark the section being discussed. The position is occurrence-specific, which matters when a node is cloned:

cub render tutorial.leo --current 0/0/1

The current node and its ancestors receive CSS classes that the site theme can highlight.

Collapse the sample

For a compact book sidebar or a step-by-step tutorial, collapse unrelated branches and open the path around the current section:

cub render tutorial.leo --collapsed --current 0/0/1 --expand 0/0/0

Collapsed output uses native HTML <details> elements. No JavaScript or saved Leo UI state is needed, so the page remains deterministic in CI and stable when the outline is edited.

The rendered sample

This is a mixed expanded/collapsed output, included directly so the tutorial remains previewable on Zensical versions without third-party build plugins. Documentation and Reference are open; Tasks is shown as a quiet collapsed branch marker. The static sample is not interactive.

  • Tutorial project
    • Project
      • Source
        • main.rs
        • lib.rs
        • tests.rs
      • Documentation
        • Tutorial
        • Concepts
        • Command reference
      • Tasks
    • Reference
      • Tasks ↪ clone
      • Concepts ↪ clone
      • Command reference ↪ clone