This is the documentation generation tool for pkg.odin-lang.org.
It works be reading a .odin-doc
file and generating the needed documentation for the packages in HTML.
GitHub Actions automatically generates the site each night from the master Odin branch by generating the .odin-doc
file from the examples/all
package.
- Doc Format: https://github.com/odin-lang/Odin/blob/master/core/odin/doc-format/doc_format.odin
- examples/all: https://github.com/odin-lang/Odin/tree/master/examples/all
The generator uses simple markup rules to generate more structured documentation such as code blocks or examples.
- A line starting with
Example:
will make subsequent lines that are indented with a tab a code block - A line starting with
Output:
orPossible Output:
will make subsequent lines that are indented with a tab a block to note the output of the example - Indenting lines with a tab will wrap the indented lines with a preformatted tag (<pre></pre>)
- The strings
Inputs:
andReturns:
are automatically made bold as a convention for input and output of a procedure
There can be only 1 example, and only 1 output (or possible output) block in a doc block.
To make these work, you should not use a doc block with lines that start with spaces or stars or anything. The convention is doc blocks like the following:
/*
Whether the given string is "example"
**Does not allocate**
Inputs:
- bar: The string to check
Returns:
- ok: A boolean indicating whether bar is "example"
Example:
foo("example")
foo("bar")