xidoc

Installation

You need Nim and Nimble. Make sure that ~/.nimble/bin is in your PATH.

From the Nimble package repository

nimble install xidoc
git clone https://git.sr.ht/~xigoi/xidoc cd xidoc nimble install">

Building from source

Usage

Compile some documents

xidoc foo.xd bar.xd

The default target is HTML. To choose a different target:

xidoc --target:latex foo.xd
xidoc -t:latex foo.xd
# Permitted values: -t:html, -t:latex, -t:gemtext

Snippet mode

By default, xidoc automatically includes wrappers like <html> or \begin{document}. To disable this behavior, use “snippet mode”:

xidoc --snippet snip.xd
xidoc -s snip.xd

Get help

xidoc --help
xidoc -h

Syntax

The only special characters in xidoc are square brackets, semicolons and whitespace. Everything except these characters is treated as literal text.

Commands are the basic building block of xidoc. Every command invocation is enclosed in square brackets. The first sequence of non-whitespace characters inside the brackets is treated as the command name; the remaining text is given to the command. Most commands ignore the leading whitespace. Many commands can take multiple arguments, in which case they split the text on semicolons; whitespace around the semicolons is ignored. If the first or last argument is empty, it is ignored; if you do need an empty argument in this position, just use two semicolons. If the text contains more square brackets, they may or may not be treated as a command invocation (depending on the surrounding command), but they should always be balanced.

Multiple whitespace in a row is changed into a single space in the output, which allows you to indent your code as you want without affecting the generated code.