Run this with cargo test --features gen-tests suite::math
.
$
-delimited LaTeX Math in pulldown-cmark
Mathematical expressions extension. Syntax based on https://github.com/jgm/commonmark-hs/blob/master/commonmark-extensions/test/math.md.
Inline mode mathematical expressions:
This sentence uses `$` delimiters to show math inline: $\sqrt{3x-1}+(1+x)^2$
$\sum_{k=1}^n a_k b_k$: Mathematical expression at head of line
`\` may follow just after the first `$`: $\{1, 2, 3\}$
<p>This sentence uses <code>$</code> delimiters to show math inline: <span class="math math-inline">\sqrt{3x-1}+(1+x)^2</span>
<span class="math math-inline">\sum_{k=1}^n a_k b_k</span>: Mathematical expression at head of line</p>
<p><code>\</code> may follow just after the first <code>$</code>: <span class="math math-inline">\{1, 2, 3\}</span></p>
Display mode mathematical expressions:
**The Cauchy-Schwarz Inequality**
$$\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)$$
<p><strong>The Cauchy-Schwarz Inequality</strong></p>
<p><span class="math math-display">\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)</span></p>
Inline math expressions cannot be empty, but display mode expressions can.
Oops empty $$ expression.
$$$$
<p>Oops empty $$ expression.</p>
<p><span class="math math-display"></span></p>
This is a greedy, left-to-right parser.
$x$$$$$$$y$$
$x$$$$$$y$$
$$x$$$$$$y$$
<p><span class="math math-inline">x</span><span class="math math-display"></span><span class="math math-display">y</span></p>
<p><span class="math math-inline">x</span><span class="math math-display"></span><span class="math math-inline">y</span>$</p>
<p><span class="math math-display">x</span><span class="math math-display"></span>y$$</p>
Math expressions pass their content through as-is, ignoring any other inline Markdown constructs:
$a<b>c</b>$
$${a*b*c} _c_ d$$
$not `code`$
$![not an](/image)$
$<https://not.a.link/>$
$α$
<p><span class="math math-inline">a<b>c</b></span></p>
<p><span class="math math-display">{a*b*c} _c_ d</span></p>
<p><span class="math math-inline">not `code`</span></p>
<p><span class="math math-inline">![not an](/image)</span></p>
<p><span class="math math-inline"><https://not.a.link/></span></p>
<p><span class="math math-inline">&alpha;</span></p>
Sole $
characters without a matching pair in the same block element
are handled as normal text.
Hello $world.
Dollar at end of line$
<p>Hello $world.</p>
<p>Dollar at end of line$</p>
Mathematical expressions can continue across multiple lines:
$5x + 2 =
17$
$$\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right)
\left( \sum_{k=1}^n b_k^2 \right)$$
<p><span class="math math-inline">5x + 2 =
17</span></p>
<p><span class="math math-display">\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right)
\left( \sum_{k=1}^n b_k^2 \right)</span></p>
Markdown hard breaks are also not recognized inside math expressions:
$not a\
hard break
either$
<p><span class="math math-inline">not a\
hard break
either</span></p>
$
character can be escaped with backslash in mathematical expressions:
$\$$
$$y = \$ x$$
<p><span class="math math-inline">\$</span></p>
<p><span class="math math-display">y = \$ x</span></p>
Inline mode math expressions cannot contain unescaped $
characters.
Neither can display math.
$x $ x$
$$ $ $$
<p>$x $ x$</p>
<p>$$ $ $$</p>
alpha$$beta$gamma$$delta
<p>alpha$<span class="math math-inline">beta</span>gamma$$delta</p>
Inline math expressions cannot start or end with whitespace, including newlines:
these are not math texts: $ y=x$, $y=x $, $
y=x$ and $y=x
$
>The start of a line counts as whitespace $2 +
>$
While displays can start with whitespace, {${
they should not allow inlines to do that $$2 +
$*$
<p>these are not math texts: $ y=x$, $y=x $, $
y=x$ and $y=x
$</p>
<blockquote>
<p>The start of a line counts as whitespace $2 +
$</p>
</blockquote>
<p>While displays can start with whitespace, {${
they should not allow inlines to do that $$2 +
<span class="math math-inline">*</span></p>
Inline math expressions do not need to be surrounded with whitespace:
these are math texts: foo$y=x$bar and $y=x$bar and foo$y=x$ bar
<p>these are math texts: foo<span class="math math-inline">y=x</span>bar and <span class="math math-inline">y=x</span>bar and foo<span class="math math-inline">y=x</span> bar</p>
Inline math expressions can be surrounded by punctuation:
math texts: $x=y$! and $x=y$? and $x=y$: and $x=y$. and $x=y$"
also math texts: !$x=y$! and ?$x=y$? and :$x=y$: and .$x=y$. and "$x=y$"
braces: ($x=y$) [$x=y$] {$x=y$}
<p>math texts: <span class="math math-inline">x=y</span>! and <span class="math math-inline">x=y</span>? and <span class="math math-inline">x=y</span>: and <span class="math math-inline">x=y</span>. and <span class="math math-inline">x=y</span>"</p>
<p>also math texts: !<span class="math math-inline">x=y</span>! and ?<span class="math math-inline">x=y</span>? and :<span class="math math-inline">x=y</span>: and .<span class="math math-inline">x=y</span>. and "<span class="math math-inline">x=y</span>"</p>
<p>braces: (<span class="math math-inline">x=y</span>) [<span class="math math-inline">x=y</span>] {<span class="math math-inline">x=y</span>}</p>
Math expression as only item on a line:
$x=y$
<p><span class="math math-inline">x=y</span></p>
Math expressions can be immediately followed by other math expressions:
$a$$b$
$a$$$b$$
$$a$$$b$
$$a$$$$b$$
<p><span class="math math-inline">a</span><span class="math math-inline">b</span></p>
<p><span class="math math-inline">a</span><span class="math math-display">b</span></p>
<p><span class="math math-display">a</span><span class="math math-inline">b</span></p>
<p><span class="math math-display">a</span><span class="math math-display">b</span></p>
Both inline and display mode math expressions are inline elements with the same precedence as code spans. The leftmost valid element takes priority:
$Inline `first$ then` code
`Code $first` then$ inline
$$ Display `first $$ then` code
`Code $$ first` then $$ display
<p><span class="math math-inline">Inline `first</span> then` code</p>
<p><code>Code $first</code> then$ inline</p>
<p><span class="math math-display"> Display `first </span> then` code</p>
<p><code>Code $$ first</code> then $$ display</p>
Indicators of block structure take precedence over math expressions:
$x + y - z$
$x + y
- z$
$$ x + y
> z $$
<p><span class="math math-inline">x + y - z</span></p>
<p>$x + y</p>
<ul>
<li>z$</li>
</ul>
<p>$$ x + y</p>
<blockquote>
<p>z $$</p>
</blockquote>
This also means that math expressions cannot contain empty lines, since they start a new paragraph:
$not
math$
$$
not
math
$$
<p>$not</p>
<p>math$</p>
<p>$$
not</p>
<p>math
$$</p>
It also implies that math notation has lower parsing power than block elements.
- $not
- *
math$
<ul>
<li>$not
<ul>
<li>
<ul>
<li>
</li>
</ul>
</li>
</ul>
math$</li>
</ul>
Note that math can contain embedded math. In scanning for a closing delimiter, we skip material in balanced curly braces:
This is display math:
$$
\text{Hello $x^2$}
$$
And this is inline math:
$\text{Hello $x$ there!}$
<p>This is display math:
<span class="math math-display">
\text{Hello $x^2$}
</span>
And this is inline math:
<span class="math math-inline">\text{Hello $x$ there!}</span></p>
Math expressions must be nested within balanced curly braces. Backslash-escaped braces do not count.
This is not valid math: $}{$
Neither is this: { $}{$ }
This is: $\}\{$
This is: $\}$
Math environment contains 2+2: $}$2+2$
Math environment contains y: $x {$ $ } $y$
<p>This is not valid math: $}{$</p>
<p>Neither is this: { $}{$ }</p>
<p>This is: <span class="math math-inline">\}\{</span></p>
<p>This is: <span class="math math-inline">\}</span></p>
<p>Math environment contains 2+2: $}<span class="math math-inline">2+2</span></p>
<p>Math environment contains y: $x {$ $ } <span class="math math-inline">y</span></p>
Math expressions must contain properly nested braces.
This is not display math. It is inline math:
$$\text{first $$ second}$
$$$\text{first $$ second}$
This is display math:
$$\text{first $$ second}$$
$$$\text{first $$ second}$$
This is also display math, but (counterintuitively) it's allowed to be empty
and expected to be as short as possible:
$$$$\text{first $$ second}$$
<p>This is not display math. It is inline math:</p>
<p>$<span class="math math-inline">\text{first $$ second}</span></p>
<p>$$<span class="math math-inline">\text{first $$ second}</span></p>
<p>This is display math:</p>
<p><span class="math math-display">\text{first $$ second}</span></p>
<p>$<span class="math math-display">\text{first $$ second}</span></p>
<p>This is also display math, but (counterintuitively) it's allowed to be empty
and expected to be as short as possible:</p>
<p><span class="math math-display"></span>\text{first $$ second}$$</p>
Dollar signs must also be backslash-escaped if they occur within math:
$\text{\$}$
$$x$x$$
${$^$$
$}$$$$
$}$] $$
<p><span class="math math-inline">\text{\$}</span></p>
<p>$<span class="math math-inline">x</span>x$$</p>
<p>${<span class="math math-inline">^</span>$</p>
<p>$}<span class="math math-display"></span></p>
<p>$}$] $$</p>
Edge case tests comparison with GitHub
Test cases https://raw.githubusercontent.com/nschloe/github-math-bugs/db938ff690ab7c534d8195fe4a1a5163c20b1134/README.md
Inline math wrapped in quotes
$x$ $`y`$
<p><span class="math math-inline">x</span> <span class="math math-inline">`y`</span></p>
Inline and display math in the same list
- $a$
```math
a
```
$$
a
$$
- ```math
b
```
$$
b
$$
<ul>
<li>
<p><span class="math math-inline">a</span></p>
<pre><code class="language-math">a
</code></pre>
<p><span class="math math-display">
a
</span></p>
</li>
<li>
<pre><code class="language-math">b
</code></pre>
<p><span class="math math-display">
b
</span></p>
</li>
</ul>
Images and math in the same list
- ![node logo](https://nodejs.org/static/images/logo.svg)
- $x$
<ul>
<li><img src="https://nodejs.org/static/images/logo.svg" alt="node logo" /></li>
<li><span class="math math-inline">x</span></li>
</ul>
Inline and display math in <details>
<details>
$A = 5$
$$
A = 5
$$
</details>
<details>
<p><span class="math math-inline">A = 5</span></p>
<p><span class="math math-display">
A = 5
</span></p>
</details>
<
without surrounding whitespace
$a<b$
$$a<b$$
<p><span class="math math-inline">a<b</span></p>
<p><span class="math math-display">a<b</span></p>
Math in footnotes
[^a]
[^a]: Lorem $a$
<p><sup class="footnote-reference"><a href="#a">1</a></sup></p>
<div class="footnote-definition" id="a"><sup class="footnote-definition-label">1</sup>
<p>Lorem <span class="math math-inline">a</span></p>
</div>
Math in links
[$a$](x)
<p>
<a href="x"><span class="math math-inline">a</span></a>
</p>
Math preceded by an alphabetical character
a$x$
-$x$
1$x$
<p>a<span class="math math-inline">x</span></p>
<p>-<span class="math math-inline">x</span></p>
<p>1<span class="math math-inline">x</span></p>
Inline math at the end of italic text
_$a$ equals $b$_
_$a$ equals $b$_
**$a$ equals $b$**
<p><em><span class="math math-inline">a</span> equals <span class="math math-inline">b</span></em></p>
<p><em><span class="math math-inline">a</span> equals <span class="math math-inline">b</span></em></p>
<p><strong><span class="math math-inline">a</span> equals <span class="math math-inline">b</span></strong></p>
Dollar in \text
$$
a
$$
- $$
\text{$b$}
$$
<p><span class="math math-display">
a
</span>
</p><ul>
<li><span class="math math-display">
\text{$b$}
</span></li>
</ul>
Backslashes in $
-math
$\{a\,b\}$
<p><span class="math math-inline">\{a\,b\}</span></p>
Math vs. HTML mix-up
$a <b > c$
$[(a+b)c](d+e)$
${a}_b c_{d}$
<p><span class="math math-inline">a <b > c</span></p>
<p><span class="math math-inline">[(a+b)c](d+e)</span></p>
<p><span class="math math-inline">{a}_b c_{d}</span></p>
Dollar-math with spaces
When $a \ne 0$, there are two solutions to $(ax^2 + bx + c = 0)$ and they are
$$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$
<p>When <span class="math math-inline">a \ne 0</span>, there are two solutions to <span class="math math-inline">(ax^2 + bx + c = 0)</span> and they are
<span class="math math-display"> x = {-b \pm \sqrt{b^2-4ac} \over 2a} </span></p>
Spacing around dollar sign in math mode
$x = \$$
<p><span class="math math-inline">x = \$</span></p>
Math in italic text
_Equation $\Omega(69)$ in italic text_
<p><em>Equation <span class="math math-inline">\Omega(69)</span> in italic text</em></p>
Inline math can't be preceded by brackets, quotation marks etc.
$\pi$
'$\pi$
"$\pi$
($\pi$
[$\pi$
{$\pi$
/$\pi$
<p>
<span class="math math-inline">\pi</span>
'<span class="math math-inline">\pi</span>
"<span class="math math-inline">\pi</span>
(<span class="math math-inline">\pi</span>
[<span class="math math-inline">\pi</span>
{<span class="math math-inline">\pi</span>
/<span class="math math-inline">\pi</span>
</p>
Relationship with tables
As a block element, tables parsing is stronger than math.
| first $|$ second |
|--------|---------|
| a ${ | }$ b |
<table><thead>
<tr><th>first $</th><th>$ second</th></tr>
</thead><tbody>
<tr><td>a ${</td><td>}$ b</td></tr>
</tbody></table>
As a special case, pipes in math environments in tables are escaped with backslashes. Though backslash-escaped characters in math environments are normally passed through verbatim to the LaTeX engine, escaped pipes in tables are an exception like they are in code spans.
The behavior of the table parser should be as-if it found the bounds
of the table cell in a separate pass that only looked for the
strings |
and \|
, treating pipes as boundaries and removing the
escaping backslash before passing the string to the inline parser.
| first $\|$ second |
|-------------------|
| a ${ \| }$ b |
<table><thead>
<tr><th>first <span class="math math-inline">|</span> second</th></tr>
</thead><tbody>
<tr><td>a <span class="math math-inline">{ | }</span> b</td></tr>
</tbody></table>
| Description | Test case |
|-------------|-----------|
| Single | $\$ |
| Double | $\\$ |
| Basic test | $\|$ |
| Basic test 2| $\|\|\$ |
| Basic test 3| $x\|y\|z\$|
| Not pipe | $\.$ |
| Combo | $\.\|$ |
| Combo 2 | $\.\|\$ |
| Extra | $\\\.$ |
| Wait, what? | $\\|$ |
| Wait, what? | $\\\|$ |
| Wait, what? | $\\\\|$ |
| Wait, what? | $\\\\\|$ |
<table><thead><tr><th>Description</th><th>Test case</th></tr></thead><tbody>
<tr><td>Single</td><td>$$</td></tr>
<tr><td>Double</td><td><span class="math math-inline">\\</span></td></tr>
<tr><td>Basic test</td><td><span class="math math-inline">|</span></td></tr>
<tr><td>Basic test 2</td><td>$||$</td></tr>
<tr><td>Basic test 3</td><td>$x|y|z$</td></tr>
<tr><td>Not pipe</td><td><span class="math math-inline">\.</span></td></tr>
<tr><td>Combo</td><td><span class="math math-inline">\.|</span></td></tr>
<tr><td>Combo 2</td><td>$.|$</td></tr>
<tr><td>Extra</td><td><span class="math math-inline">\\\.</span></td></tr>
<tr><td>Wait, what?</td><td><span class="math math-inline">\|</span></td></tr>
<tr><td>Wait, what?</td><td><span class="math math-inline">\\|</span></td></tr>
<tr><td>Wait, what?</td><td><span class="math math-inline">\\\|</span></td></tr>
<tr><td>Wait, what?</td><td><span class="math math-inline">\\\\|</span></td></tr>
</tbody></table>
Implementation limits
Implementations may impose limits on brace nesting to avoid performance issues, but at least three levels of nesting should be supported.
Pulldown-cmark imposes the following limits:
- At 25 levels of nesting, it switches from tracking nested pairs to simply counting the number of braces. This means the below example will spurriously recognize a math environment with the correct number of braces, but not nested correctly.
This is not an inline math environment: $}{$
But, because it's nested too deeply, this is parsed as an inline math environment:
{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{
improperly $}{$ nested
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
But this still isn't, because the braces are still counted: $}{$
<p>This is not an inline math environment: $}{$
But, because it's nested too deeply, this is parsed as an inline math environment:
{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{
improperly <span class="math math-inline">}{</span> nested
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
But this still isn't, because the braces are still counted: $}{$</p>
This is also deeply nested, but, unlike the first example,
they don't have an equal number of close braces and open braces,
so aren't detected as math.
{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{
improperly $}$ nested ${$ example
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
This, however, is detected ${}$
${{{{{{{{{{{{{{{{{{{{{{{{{{{{{{
another improperly nested example
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}$
<p>This is also deeply nested, but, unlike the first example,
they don't have an equal number of close braces and open braces,
so aren't detected as math.
{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{
improperly $}$ nested ${$ example
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
This, however, is detected <span class="math math-inline">{}</span></p>
<p><span class="math math-inline">{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{
another improperly nested example
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}</span></p>
- At 255 distinct brace-delimited groups, the counter rolls over. This means the below example will spurriously recognize an incorrectly-nested inline math environment.
${}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{} 20 brace pairs
{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{} 40 brace pairs
{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{} 60 brace pairs
{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{} 80 brace pairs
{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{} 100 brace pairs
{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{} 120 brace pairs
{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{} 140 brace pairs
{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{} 160 brace pairs
{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{} 180 brace pairs
{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{} 200 brace pairs
{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{} 220 brace pairs
{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{} 240 brace pairs
{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{$ 255 brace pairs and one unclosed brace
<p><span class="math math-inline">{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{} 20 brace pairs
{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{} 40 brace pairs
{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{} 60 brace pairs
{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{} 80 brace pairs
{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{} 100 brace pairs
{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{} 120 brace pairs
{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{} 140 brace pairs
{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{} 160 brace pairs
{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{} 180 brace pairs
{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{} 200 brace pairs
{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{} 220 brace pairs
{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{} 240 brace pairs
{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{</span> 255 brace pairs and one unclosed brace</p>
- Thanks to rule 1, though, deeply-nested structures won't chew through all of the ID space. This means that the below example, even though it nests 255 levels deep, parses correctly anyway.
${{{{{{{{{{{{{{{{{{{{ 20 open braces
{{{{{{{{{{{{{{{{{{{{ 40 open braces
{{{{{{{{{{{{{{{{{{{{ 60 open braces
{{{{{{{{{{{{{{{{{{{{ 80 open braces
{{{{{{{{{{{{{{{{{{{{ 100 open braces
{{{{{{{{{{{{{{{{{{{{ 110 open braces
{{{{{{{{{{{{{{{{{{{{ 120 open braces
{{{{{{{{{{{{{{{{{{{{ 140 open braces
{{{{{{{{{{{{{{{{{{{{ 160 open braces
{{{{{{{{{{{{{{{{{{{{ 180 open braces
{{{{{{{{{{{{{{{{{{{{ 200 open braces
{{{{{{{{{{{{{{{{{{{{ 220 open braces
{{{{{{{{{{{{{{{{{{{{ 240 open braces
{{{{{{{{{{{{{{{ 255 open braces
}}}}}}}}}}}}}}}}}}}} 20 close braces
}}}}}}}}}}}}}}}}}}}} 40 close braces
}}}}}}}}}}}}}}}}}}}} 60 close braces
}}}}}}}}}}}}}}}}}}}} 80 close braces
}}}}}}}}}}}}}}}}}}}} 100 close braces
}}}}}}}}}}}}}}}}}}}} 120 close braces
}}}}}}}}}}}}}}}}}}}} 140 close braces
}}}}}}}}}}}}}}}}}}}} 160 close braces
}}}}}}}}}}}}}}}}}}}} 180 close braces
}}}}}}}}}}}}}}}}}}}} 200 close braces
}}}}}}}}}}}}}}}}}}}} 220 close braces
}}}}}}}}}}}}}}}}}}}} 240 close braces
}}}}}}}}}}}}}}}{$ 255 close braces and one open brace
<p>${{{{{{{{{{{{{{{{{{{{ 20 open braces
{{{{{{{{{{{{{{{{{{{{ 40 open braces
{{{{{{{{{{{{{{{{{{{{ 60 open braces
{{{{{{{{{{{{{{{{{{{{ 80 open braces
{{{{{{{{{{{{{{{{{{{{ 100 open braces
{{{{{{{{{{{{{{{{{{{{ 110 open braces
{{{{{{{{{{{{{{{{{{{{ 120 open braces
{{{{{{{{{{{{{{{{{{{{ 140 open braces
{{{{{{{{{{{{{{{{{{{{ 160 open braces
{{{{{{{{{{{{{{{{{{{{ 180 open braces
{{{{{{{{{{{{{{{{{{{{ 200 open braces
{{{{{{{{{{{{{{{{{{{{ 220 open braces
{{{{{{{{{{{{{{{{{{{{ 240 open braces
{{{{{{{{{{{{{{{ 255 open braces
}}}}}}}}}}}}}}}}}}}} 20 close braces
}}}}}}}}}}}}}}}}}}}} 40 close braces
}}}}}}}}}}}}}}}}}}}} 60 close braces
}}}}}}}}}}}}}}}}}}}} 80 close braces
}}}}}}}}}}}}}}}}}}}} 100 close braces
}}}}}}}}}}}}}}}}}}}} 120 close braces
}}}}}}}}}}}}}}}}}}}} 140 close braces
}}}}}}}}}}}}}}}}}}}} 160 close braces
}}}}}}}}}}}}}}}}}}}} 180 close braces
}}}}}}}}}}}}}}}}}}}} 200 close braces
}}}}}}}}}}}}}}}}}}}} 220 close braces
}}}}}}}}}}}}}}}}}}}} 240 close braces
}}}}}}}}}}}}}}}{$ 255 close braces and one open brace</p>