ArcMoon 1.1.0

Start

Language

Reference

Nothing matches “”.

↑↓ move Enter open Esc close

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:

index.arcm
[p]Write \[p] for a paragraph.[end]
[p]Issue \#42 is fixed.[end]
[p]Write \${ code }$ to show it.[end]
Result

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.
index.arcm
[p]Write \[p] for a paragraph.[end]
[p]Issue \#42 is fixed.[end]
[p]Write \${ code }$ to show it.[end]
HTML ArcMoon builds
<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 $:

index.arcm
[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]
HTML ArcMoon builds
<p>Time: 10:30, a = b, list [ 1, 2 ]</p>
<p>Price: $5, 50%, x ] y</p>
<p>&lt;b> &amp; 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:

index.arcm
[p]C:\Users\Adam[end]
[p]C:\\Users\\Adam[end]
HTML ArcMoon builds
<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:

index.arcm
[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]
HTML ArcMoon builds
<p title="Say &quot;hi&quot;">Double quotes</p>
<p title="It&#x27;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:

index.arcm
${ const version = "1.0"; }$
[p]The \runtime ${ version }$ is out.[end]
[p]The runtime is fast.[end]
HTML ArcMoon builds
<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]:

index.arcm
[pre = arcm-raw: true]
[b]bold\[end] # not a comment
[end]
HTML ArcMoon builds
<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:

index.arcm
${ const path = "C:\\Users"; }$
[p]${ path }$[end]
[style]
  p::before { content: "\201C"; }
[end]
HTML ArcMoon builds
<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].