Warning: Work in progress! Leave feedback on Zulip or Github if you'd like this doc to be updated.

How We Build Oils Documentation

  1. Write Markdown by hand, with optional "front matter".
  2. Render Markdown to HTML, and run the result through our own HTML filters.
  3. Publish static HTML to https://www.oilshell.org/.

The code is in the doctools/ directory, which uses the lazylex/ library.

Table of Contents
Quick Start
Front Matter and Title
Plugins That Transform HTML
Table of Contents
Link Shortcuts, e.g. $xref
Syntax Highlighting of Code Blocks
Convenient Tables with ul-table
Code Location
Related

Quick Start

To build and preview this doc, run:

build/doc.sh split-and-render doc/doc-toolchain.md

Open the path in prints in your browser (_release/VERSION/doc/doc-toolchain.html).

Front Matter and Title

Most docs start with something like this:

---
in_progress: yes
default_highlighter: oils-sh
---

My Title
========

Hello

The "front matter" between --- lines is metadata for rendering the doc. Github's web UI understands and renders it.

Plugins That Transform HTML

We have some HTML plugins that make writing markdown easier. Note that CommonMark tightens up the rules for embedding HTML in Markdown, and that is very useful.

Table of Contents

Insert this into the doc

<div id="toc">
</div>

and it will be expanded into a table of contents derived from h2 and h3 tags.

Link Shortcuts, e.g. $xref

Markdown:

The [GNU bash shell]($xref:bash)

After CommonMark:

The <a href="$xref:bash">GNU bash shell</a>

After our $xref: plugin:

The <a href="/cross-ref.html#bash">GNU bash shell</a>

Example: The GNU bash shell


If the argument is omitted, then the anchor text is used. So you can just write:

[bash][]

and it will become:

The <a href="/cross-ref.html#bash">bash</a>

Example: bash

List of plugins:

See the raw and rendered versions of this doc for more:

Syntax Highlighting of Code Blocks

Use Markdown's fenced code blocks like this:

```oil-sh
ysh$ var x = 'hello world'
ysh$ echo $x
hello world
```

Example:

ysh$ var x = 'hello world'
ysh$ echo $x
hello world

Or you can set default_highlighter for blocks indented by 4 spaces.

Again see doc-plugins.md for examples.

Convenient Tables with ul-table

See this doc: ul-table: Markdown Tables Without New Syntax

Code Location

Related

Generated on Sun, 05 Jan 2025 23:28:55 -0500