5 Syntax

Booklit documents are Markdown files extended with a special syntax for function calls. Standard Markdown formatting (emphasis, bold, links, code, lists, etc.) is supported natively, and everything else is either text or an \invoke call.

5.1 Prose Syntax

Booklit builds on top of standard Markdown, so the prose rules are familiar:

5.2 Comment Syntax

Comments are delimited by {- and -}. They can be multi-line, appear in between words, and they can also be nested. This makes commenting out large blocks of content easy:

Hi, I'm{- a comment -} in the middle of a sentence!

{-
  I'm hanging out at the top level,

  {- being nested and stuff -}

  with multiple lines.
-}

5.3 Function Syntax

Function calls are denoted by \ followed by a series of alphanumeric characters and hyphens (foo-bar), forming the function name.

To produce a literal \ character, use \\ (standard Markdown backslash escape).

Following the name, there may be any number of arguments, which can come in a few different forms:

{line}

With no linebreak after the {, the argument forms a single line. Markdown formatting is applied within the argument.

{word wrapped line}

As above, but soft line breaks are converted into a single space, as if it were written as {word wrapped line}.

{
paragraph 1

paragraph 2
}

With a linebreak after the {, the argument forms a block of paragraphs with full Markdown and function call support.

{{
paragraph 1

  indented paragraph 2

\with{syntax}
}}

With doubled-up curly braces, whitespace is preserved in the content, rather than being parsed into paragraphs. Function calls (\invoke) are still recognized within preformatted blocks.

Note that the first line of the content determines an indentation level that is then stripped for all lines. It is the only whitespace that is ignored.

{{{
paragraph 1

  indented {paragraph} 2

\not-parsed{no-syntax}
}}}

Tripled-up curly braces form a verbatim argument. Similar to preformatted, whitespace is preserved. In addition, there is no interpreting or parsing of function calls or Markdown within. This is useful for large code blocks where the content may contain special characters like \, {, or }.