! TypoML

!! Installation

TypoML requires the Odin compiler. Build from source:

```
make build
```

This creates the TypoML executable in the current directory. (wow, how unexpected)

!! Usage

TypoML reads from stdin and outputs HTML to stdout:

```
cat input.tlm | ./TypoML > output.html
```

It can also read one or more (added in the order of command line arguments) `.tlm` files:

```
./TypoML input.tlm > output.html
```

Run `./TypoML --help` for the full list of options.

!! Options

- `--title <text>` - Set the HTML document `<title>` (default: `TypoML`)
- `--plain` - Don't wrap the output in `<html>`, `<head>`, `<body>` and `<style>` tags
- `--no-js` - Don't include the JavaScript variable proxy
- `--no-wrapper` - Shortcut for `--plain` and `--no-js` at once
- `--print-tree` - Print the token tree instead of HTML
- `-h`, `--help` - Show the help text and exit

Examples:

```
./TypoML doc.tlm --title "TITLE" > doc.html
./TypoML doc.tlm --no-wrapper > fragment.html
./TypoML doc.tlm --print-tree
```

---

!! Syntax

!!! Text Formatting

`*` - *italic* - Italic text
`**` - **bold** - Bold text
`***` - ***bold italic*** - Bold and italic
`--`/`~~` - --strikethrough-- - Strikethrough text
`__` - __underlined__ - Underlined text
`_` - H_2_O_4_U - Subscript
`^` - Δ = b^2^ - 4ac - Superscript

---

!!! Headings

\! Heading 1
\!! Heading 2
\!!! Heading 3
(And so on)

Result:

! Heading 1
!! Heading 2
!!! Heading 3

---

!!! Links

\#[Link text](url) - Standard link
\#(url)[Link text] - Can go either way
\#[url] - Auto-link (no alt text)
[Link text](\#heading) - Header link (anchor) (can also be done like an auto-link, then the text is auto-generated from the heading)

Result:

#[Link text](https://example.com) - Standard link
#(https://example.com)[Link text] - Can go either way
#[https://example.com] - Auto-link (no alt text)
[Link text](#headings) - Header link (anchor)

---

!!! Alignment

Placed at the end of start of a line

\>> - Right aligned
\<< - Left aligned
\^^ - Center aligned

Result:

This text is right aligned >>
This text is left aligned <<
This text is center aligned ^^

---

!!! Embedded Content

\$[url] - Auto-detect type
\$(url) - Can also be done like this

To force a specific type, use \$[url|type]

Types:

- `image`, `img`, `i`
- `audio`, `a`
- `video`, `v`
- `iframe`, `frame`, `f`
- `script`, `s`, `javascript`, `js`

Result:

$[https://upload.wikimedia.org/wikipedia/commons/b/b2/Voynich_manuscript_recipe_example_107r_crop.jpg|img]
$[staircase.mp3]

---

!!! Lists

- Item 1
. Item 2

Unordered lists use - or . as markers.

1. First item
2. Second item

Ordered lists use numbers followed by periods.

---

!!! Code Blocks

```language
code here
```

Inline code uses backticks: `code`

---

!!! Tables

| Header 1 | Header 2 | Header 3 |
|---|---|---|
| Cell 1 << | Cell 2 >> | Cell 3 ^^ |

Do not need a header to work, just the first separator row (`|---|---|---|`)
Can be aligned using the alignment markers

---

!!! Blockquotes

\> This is a blockquote
\> Multiple lines are supported

Result:

> This is a blockquote
> Multiple lines are supported

---

!!! Footnotes

[\&footnote] - Footnote reference
[\&&footnote] - Footnote definition

Can be numbers or names

Result:

Here is a footnote reference [&demo]

[&&demo] And here is its definition

---

!!! Variables

\$(name=value) - Define a variable
\$(name) - Use a variable

Result:

$(greeting=Hello, world!)

The value of `greeting` is: $(greeting)

Variables can be accessed in JavaScript using `tlm.<name>` (without the `<>`)

---

!!! Script Blocks

\$[script]
JavaScript code here
\$[/script]

Result:

$[script]
console.log("Hello from TypoML!");
$[/script]

(Open your browser's console to see the output)

---

!!! Escaping

Standard escaping using a backslash (`\`)

!!! Horizontal Rules

\---, \___, or \===

Three or more, have to be on their own line

Result:

---
