# Chapbook

Examples taken from the [Chapbook online documentation](https://klembot.github.io/chapbook/guide)

{% hint style="warning" %}
Chapbook and Moontale have fundamentally different use cases! This guide is not exhaustive.
{% endhint %}

## Syntax

The following syntax is identical in both Chapbook and Moontale:

* `[[Passage]]`
* `[[Link->Target]]`
* `[[Target<-Link]]`
* `*Emphasis*`
* `**Strong emphasis**`
* `` `Monospace` ``
* `Line breaks \`
* `***`
* `* Unordered lists`
* `1. Ordered lists`

| Chapbook                                                                                                                       | Moontale                                                                                                                                                                                               |
| ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `<del>Strike through</del>`                                                                                                    | `~~Strike through~~`                                                                                                                                                                                   |
| `> [[Fork target]]`                                                                                                            | <p>⚠️ <strong>Not supported</strong></p><p>You can use a custom tag or just the plain link to achieve this</p>                                                                                         |
| `[align center]` and friends                                                                                                   | `$Align.right[`, `$Align.center[`, `$Align.justify[`, and `$Align.left[`                                                                                                                               |
| `[after 1 second]`                                                                                                             | `$Delay(1.0)[`🚧                                                                                                                                                                                       |
| `[append]`                                                                                                                     | Don't leave a line break between sections                                                                                                                                                              |
| <p><code>\[note]</code></p><p><code>I really need a better beginning</code></p>                                                | `{$ -- I really need a better beginning $}`                                                                                                                                                            |
| `{back link, label: 'retreat for now'}`                                                                                        | `$Back[retreat for now]`🚧                                                                                                                                                                             |
| `{restart link, label: 'Oh forget it all'}`                                                                                    | `$On.click(hardReset)[Oh forget it all]`                                                                                                                                                               |
| `{link to: 'passage', label: 'Text'}`                                                                                          | `$Link('passage')[Text]`                                                                                                                                                                               |
| `{reveal link: 'something odd occurred', text: 'I saw five deer...'}`                                                          | <p><code>$On.click<\<x = true; Reload()>>\[something odd occurred]</code><br><code>$If(x)\[I saw five deer...]</code></p>                                                                              |
| `{reveal link: 'groceries', passage: 'Shopping list'}`                                                                         | <p><code>$On.click<\<x = true; Reload()>>\[groceries]</code> </p><p><code>$If(x)\[\[ ->Shopping list]]</code></p>                                                                                      |
| `{embed passage: 'L.A.'}`                                                                                                      | `$Display('L.A.')`                                                                                                                                                                                     |
| <p><code>strength: 18</code></p><p><code>dexterity: 7</code></p><p><code>--</code></p>                                         | <p><code>{$ strength = 18</code></p><p>   <code>dexterity = 7</code></p><p><code>$}</code></p>                                                                                                         |
| `"Hi, {name}," your guide greets you.`                                                                                         | `"Hi, $name," your guide greets you.`                                                                                                                                                                  |
| <p><code>\_unreasonablePrice: cash + 3</code></p><p><code>--</code></p><p><code>I want {\_unreasonablePrice} for it</code></p> | `I want <$ cash + 3 $> for it`                                                                                                                                                                         |
| <p><code>\[if hasKey]</code></p><p><code>You could try \[\[unlocking it]] with the key</code></p>                              | `$If(hasKey)[You could try [[unlocking it]] with the key]`                                                                                                                                             |
| <p><code>\[else]</code></p><p><code>Nothing to do here but \[\[turn back]]</code></p>                                          | `$Else[ Nothing to do here but [[turn back]] ]`                                                                                                                                                        |
| <p><code>transportation: 'car'</code></p><p><code>transportation (kilometers > 1000): 'plane'</code></p><p><code>--</code></p> | <p><code>${ if(kilometers > 1000) then</code></p><p>     <code>transporation = 'car'</code></p><p>   <code>else</code></p><p>     <code>transportation = 'car'</code></p><p>   <code>end $}</code></p> |
| <p><code>my.favorite.variable: 'red'</code></p><p><code>--</code></p>                                                          | `{$ my = { favorite = { variable = 'red } } $}`                                                                                                                                                        |
