Language
Escaping
Writing [, #, ${ and \ as plain text, quoted values, and arcm-raw.
Why escape
A few characters mean something to ArcMoon: [name opens a block, # starts a comment, ${ starts code. To write them as plain text, put a backslash \ in front. Try it: remove a backslash and press Run:
[p]Write \[p] for a paragraph.[end]
[p]Issue \#42 is fixed.[end]
[p]Write \${ code }$ to show it.[end]
In text
Escape these when you mean the characters themselves:
\[before a name:\[p]writes[p]instead of opening a paragraph.\#: a#instead of a comment.\${: shows${ … }$instead of running it.\\: a backslash itself.
[p]Write \[p] for a paragraph.[end]
[p]Issue \#42 is fixed.[end]
[p]Write \${ code }$ to show it.[end]<p>Write [p] for a paragraph.</p>
<p>Issue #42 is fixed.</p>
<p>Write ${ code }$ to show it.</p>
What needs no escape
Everything else is plain text, including :, ,, =, a lone ], [ followed by a space, and $:
[p]Time: 10:30, a = b, list [ 1, 2 ][end]
[p]Price: $5, 50%, x ] y[end]
[p]<b> & co are safe: they are escaped for you.[end]<p>Time: 10:30, a = b, list [ 1, 2 ]</p>
<p>Price: $5, 50%, x ] y</p>
<p><b> & co are safe: they are escaped for you.</p>
< and & are escaped into the HTML for you, so text can never turn into tags. To write HTML, use blocks, or { raw } from build-time code.
The backslash itself
In text, a backslash makes the next character plain, whatever it is, and disappears. So a real backslash needs two:
[p]C:\Users\Adam[end]
[p]C:\\Users\\Adam[end]<p>C:UsersAdam</p>
<p>C:\Users\Adam</p>
Watch for this with Windows paths and regular expressions in text.
In quoted values
Inside "…" or '…', only the quote you used needs a backslash. Other backslashes stay as written, and [, #, : and the rest are plain:
[p = title: "Say \"hi\""]Double quotes[end]
[p = title: 'It\'s fine']Single quotes[end]
[p = title: "C:\Users\Adam"]Other backslashes stay[end]
[p = title: "a: b, c = d, [x] #1"]Nothing else needs escaping[end]<p title="Say "hi"">Double quotes</p>
<p title="It's fine">Single quotes</p>
<p title="C:\Users\Adam">Other backslashes stay</p>
<p title="a: b, c = d, [x] #1">Nothing else needs escaping</p>
Use the other kind of quote to avoid backslashes: title: 'Say "hi"'.
The word runtime
runtime right before ${ makes a live value. To write the word and then a build-time value, escape the word. Anywhere else it needs nothing:
${ const version = "1.0"; }$
[p]The \runtime ${ version }$ is out.[end]
[p]The runtime is fast.[end]<p>The runtime 1.0 is out.</p>
<p>The runtime is fast.</p>
Lots of code: arcm-raw
To show a block of ArcMoon code, escaping every bracket gets tiring. arcm-raw: true writes the body as it is: blocks and comments are not read. The body ends at the first [end], so write each [end] inside as \[end]:
[pre = arcm-raw: true]
[b]bold\[end] # not a comment
[end]<pre>
[b]bold[end] # not a comment
</pre>
In code and CSS
Inside ${ }$, runtime ${ }$ and [style], ArcMoon's escaping doesn't apply. JavaScript and CSS use their own rules:
${ const path = "C:\\Users"; }$
[p]${ path }$[end]
[style]
p::before { content: "\201C"; }
[end]<style>p:before{content:"\201c"}</style><p>C:\Users</p>
"C:\\Users" is a JavaScript string, and "\201C" is a CSS escape for “.
Mistakes
A missed escape usually shows up as a block that never closes:
✗ [p] opened at 1:1 is missing [end]. The "#" on line 1 starts a comment, which hides the rest of that line, including its [end]. For the character itself, write \#
✗ [p] opened at 1:1 is missing [end]
✗ [for-each] needs an array first: [for-each = ${ items }$, as: "item"]- The first:
[p]Issue #42 is fixed[end]: the#hid the[end]. Write\#42. - The second:
[p]Write [b] for bold.[end]:[b]opened a bold block, and the one[end]closed it, leaving[p]open. Write\[b]. - The third:
[p]Use [for-each] to repeat.[end]:[for-each]was read as the real block. Write\[for-each].