Skip to content

odin-lang/pkg.odin-lang.org

Repository files navigation

pkg.odin-lang.org

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.

Markup rules

The generator uses simple markup rules to generate more structured documentation such as code blocks or examples.

Blocks

  1. A line starting with Example: will make subsequent lines that are indented with a tab a code block
  2. A line starting with Output: or Possible Output: will make subsequent lines that are indented with a tab a block to note the output of the example
  3. Indenting lines with a tab will wrap the indented lines with a preformatted tag (<pre></pre>)
  4. The strings Inputs: and Returns: 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")