Skip to content

Model source boundaries ​

Source columns, table sections, footnotes, and image attributes.

Generated from resources/examples/edge-cases.md - edit the cases there, not here. Each case links the conformance fixture it produces.

Opaque reference and inline bounds ​

9 conformance fixtures
carve
[x][m]
*[m]: y
html
<p>[x][m]</p>
carve
![x][m]
*[m]: y
html
<p>![x][m]</p>
carve
see [m] here
*[m]: y
html
<p>see [<abbr title="y">m</abbr>] here</p>
carve
|\|
html
<table>
  <tbody>
    <tr><td>|</td></tr>
  </tbody>
</table>
carve
{+`{#+}#}
html
<p>{+<code>{#+}#}</code></p>
carve
_*x
/*b*/
html
<p>_<strong>x
/*b</strong>/</p>
carve
>
html
<blockquote><p>
</p></blockquote>
carve
>
html
<blockquote><p>
</p></blockquote>
carve
$$`x
^ p
html
<figure>
  <p><span class="math display" role="math">\[x\]</span></p>
  <figcaption>p</figcaption>
</figure>

Lazy quote owners ​

2 conformance fixtures
carve
>  {c
> }
a
html
<blockquote><p>{c
}
a</p></blockquote>
carve
> - > +
> - > +
 s
html
<blockquote>
  <ul>
    <li>
      <blockquote><p>+</p></blockquote>
    </li>
    <li>
      <blockquote><p>+
s</p></blockquote>
    </li>
  </ul>
</blockquote>

A later term after a shifted separator opens in the outer item ​

3 conformance fixtures
carve
- * :: t
  : a
    :: sibling
    tail
html
<ul>
  <li>
    <ul>
      <li>
        <dl>
          <dt>t</dt>
        </dl>
      </li>
    </ul>
    : a
    <dl>
      <dt>sibling
tail</dt>
    </dl>
  </li>
</ul>
carve
> - * :: t
>   : a
>      :: sibling
>      tail
html
<blockquote>
  <ul>
    <li>
      <ul>
        <li>
          <dl>
            <dt>t</dt>
          </dl>
        </li>
      </ul>
      : a
      <dl>
        <dt>sibling
tail</dt>
      </dl>
    </li>
  </ul>
</blockquote>
carve
::: box
- * :: t
  : a
    :: sibling
    tail
:::
html
<div class="box">
  <ul>
    <li>
      <ul>
        <li>
          <dl>
            <dt>t</dt>
          </dl>
        </li>
      </ul>
      : a
      <dl>
        <dt>sibling
tail</dt>
      </dl>
    </li>
  </ul>
</div>

A task item uses the ordered item column rule ​

2 conformance fixtures
carve
* [ ] - :: t
      : a
      :: sibling
      tail
html
<ul class="task-list">
  <li><input type="checkbox" disabled> 
    <ul>
      <li>
        <dl>
          <dt>t</dt>
        </dl>
      </li>
    </ul>
    : a
    <dl>
      <dt>sibling
tail</dt>
    </dl>
  </li>
</ul>
carve
1000. - :: t
      : a
      :: sibling
      tail
html
<ol start="1000">
  <li>
    <ul>
      <li>
        <dl>
          <dt>t</dt>
        </dl>
      </li>
    </ul>
    : a
    <dl>
      <dt>sibling
tail</dt>
    </dl>
  </li>
</ol>

The deepest quoted paragraph takes a lazy line across missed prefixes ​

3 conformance fixtures
carve
> > - > +
> > - > +
>  s
html
<blockquote>
  <blockquote>
    <ul>
      <li>
        <blockquote><p>+</p></blockquote>
      </li>
      <li>
        <blockquote><p>+
s</p></blockquote>
      </li>
    </ul>
  </blockquote>
</blockquote>
carve
> > a
> b
html
<blockquote>
  <blockquote><p>a
b</p></blockquote>
</blockquote>
carve
> > * > +
> > * > +
>  tail
html
<blockquote>
  <blockquote>
    <ul>
      <li>
        <blockquote><p>+</p></blockquote>
      </li>
      <li>
        <blockquote><p>+
tail</p></blockquote>
      </li>
    </ul>
  </blockquote>
</blockquote>

A native header continues a promoted GFM header run ​

1 conformance fixture
carve
| a |
|---|
|= b |
html
<table>
  <thead>
    <tr><th scope="col">a</th></tr>
    <tr><th scope="col">b</th></tr>
  </thead>
</table>

A table ends a footnote paragraph claim ​

1 conformance fixture
carve
see[^n]

[^n]: a
  | a |
end
html
<p>see<a id="fnref1" href="#fn1" role="doc-noteref"><sup>1</sup></a></p>
<p>end</p>
<section role="doc-endnotes" aria-label="Footnotes">
  <hr>
  <ol>
    <li id="fn1">
      <p>a</p>
      <table>
        <tbody>
          <tr><td>a</td></tr>
        </tbody>
      </table>
      <p><a href="#fnref1" role="doc-backlink" aria-label="Back to reference">↩</a></p>
    </li>
  </ol>
</section>

A footnote heading does not loosen its host item ​

1 conformance fixture
carve
- see[^n]

  [^n]: a
    # h
html
<ul>
  <li>see<a id="fnref1" href="#fn1" role="doc-noteref"><sup>1</sup></a></li>
</ul>
<section role="doc-endnotes" aria-label="Footnotes">
  <hr>
  <ol>
    <li id="fn1">
      <p>a</p>
      <h1 id="h">h</h1>
      <p><a href="#fnref1" role="doc-backlink" aria-label="Back to reference">↩</a></p>
    </li>
  </ol>
</section>

A promoted GFM header keeps following native headers before the body ​

1 conformance fixture
carve
| a | b |
|---|---|
|= c |= d |
| e | f |
html
<table>
  <thead>
    <tr><th scope="col">a</th><th scope="col">b</th></tr>
    <tr><th scope="col">c</th><th scope="col">d</th></tr>
  </thead>
  <tbody>
    <tr><td>e</td><td>f</td></tr>
  </tbody>
</table>

A below-column line returns to its definition body ​

1 conformance fixture
carve
:: t
: - +
  x
html
<dl>
  <dt>t</dt>
  <dd>
    <ul>
      <li></li>
    </ul>
    <p>x</p>
  </dd>
</dl>

A lazy line keeps its plus through three quote levels ​

1 conformance fixture
carve
> > > - > +
> > > - > +
>  s
html
<blockquote>
  <blockquote>
    <blockquote>
      <ul>
        <li>
          <blockquote><p>+</p></blockquote>
        </li>
        <li>
          <blockquote><p>+
s</p></blockquote>
        </li>
      </ul>
    </blockquote>
  </blockquote>
</blockquote>

A task item uses its authored term base one column past a child marker ​

1 conformance fixture
carve
* [ ] - :: t
       : a
       :: sibling
       tail
html
<ul class="task-list">
  <li><input type="checkbox" disabled> 
    <ul>
      <li>
        <dl>
          <dt>t
: a</dt>
        </dl>
      </li>
    </ul>
    <dl>
      <dt>sibling
tail</dt>
    </dl>
  </li>
</ul>

A task item keeps a lazy term one column below its child marker ​

1 conformance fixture
carve
* [ ] - :: t
     : a
     :: sibling
     tail
html
<ul class="task-list">
  <li><input type="checkbox" disabled> 
    <ul>
      <li>
        <dl>
          <dt>t
: a</dt>
        </dl>
      </li>
    </ul>
    <dl>
      <dt>sibling
tail</dt>
    </dl>
  </li>
</ul>

A promoted image merges block attributes before inline attributes ​

1 conformance fixture
carve
{.outer k=one}
![a](b){.inner k=two}
html
<img src="b" alt="a" class="outer inner" k="two">

A content tab does not hide a description boundary ​

1 conformance fixture
carve
- :: t
: 	text
html
<ul>
  <li>
    <dl>
      <dt>t</dt>
    </dl>
  </li>
</ul>
<p>: 	text</p>

A description keeps a list marker below its hosted footnote ​

1 conformance fixture
carve
:: t
:  [^q]: note
    * child
tail
html
<dl>
  <dt>t</dt>
  <dd>
    <ul>
      <li>child
tail</li>
    </ul>
  </dd>
</dl>

An intervening column refuses a description hosted first block ​

1 conformance fixture
carve
:: t
: - +
 # H
html
<dl>
  <dt>t</dt>
  <dd>
    <ul>
      <li></li>
    </ul>
  </dd>
</dl>
<section id="H">
  <h1>H</h1>
</section>

A hosted footnote keeps a heading at its body floor ​

1 conformance fixture
carve
- a
  [^n]: +
  # h
    # h

see[^n]
html
<ul>
  <li>a
    <h1 id="h">h</h1>
  </li>
</ul>
<p>see<a id="fnref1" href="#fn1" role="doc-noteref"><sup>1</sup></a></p>
<section role="doc-endnotes" aria-label="Footnotes">
  <hr>
  <ol>
    <li id="fn1">
      <h1 id="h-2">h</h1>
      <p><a href="#fnref1" role="doc-backlink" aria-label="Back to reference">↩</a></p>
    </li>
  </ol>
</section>

Invalid body row metadata leaves one table body ​

1 conformance fixture
carve
{body-rows=x}
|= A |
html
<table body-rows="x">
  <tbody>
    <tr><th scope="row">A</th></tr>
  </tbody>
</table>

A heading inside the intervening band stays description text ​

1 conformance fixture
carve
:: t
: - +
   # H
html
<dl>
  <dt>t</dt>
  <dd>
    <ul>
      <li></li>
    </ul>
    <h1 id="H">H</h1>
  </dd>
</dl>

A below-column term stays in the footnote paragraph ​

1 conformance fixture

The note's content column is two. At column one, :: term is ordinary text. The open note paragraph claims it before block recognition. A blank line then ends the note, leaving the reference in the document.

carve
[^f]: alpha
 :: term

See[^f]
html
<dl>
  <dt>term</dt>
</dl>
<p>See<a id="fnref1" href="#fn1" role="doc-noteref"><sup>1</sup></a></p>
<section role="doc-endnotes" aria-label="Footnotes">
  <hr>
  <ol>
    <li id="fn1">
      <p>alpha<a href="#fnref1" role="doc-backlink" aria-label="Back to reference">↩</a></p>
    </li>
  </ol>
</section>

A closed footnote child releases a flush line ​

3 conformance fixtures

A heading, table, or rule ends the note paragraph. The following column-zero line belongs to the document.

carve
see[^n]

[^n]: para
   # Heading
tail
html
<p>see<a id="fnref1" href="#fn1" role="doc-noteref"><sup>1</sup></a></p>
<p>tail</p>
<section role="doc-endnotes" aria-label="Footnotes">
  <hr>
  <ol>
    <li id="fn1">
      <p>para</p>
      <h1 id="Heading">Heading</h1>
      <p><a href="#fnref1" role="doc-backlink" aria-label="Back to reference">↩</a></p>
    </li>
  </ol>
</section>
carve
see[^n]

[^n]: para
  | a |
tail
html
<p>see<a id="fnref1" href="#fn1" role="doc-noteref"><sup>1</sup></a></p>
<p>tail</p>
<section role="doc-endnotes" aria-label="Footnotes">
  <hr>
  <ol>
    <li id="fn1">
      <p>para</p>
      <table>
        <tbody>
          <tr><td>a</td></tr>
        </tbody>
      </table>
      <p><a href="#fnref1" role="doc-backlink" aria-label="Back to reference">↩</a></p>
    </li>
  </ol>
</section>
carve
see[^n]

[^n]: para
  ---
tail
html
<p>see<a id="fnref1" href="#fn1" role="doc-noteref"><sup>1</sup></a></p>
<p>tail</p>
<section role="doc-endnotes" aria-label="Footnotes">
  <hr>
  <ol>
    <li id="fn1">
      <p>para</p>
      <hr>
      <p><a href="#fnref1" role="doc-backlink" aria-label="Back to reference">↩</a></p>
    </li>
  </ol>
</section>

A note-claimed fence line keeps the item loose ​

3 conformance fixtures

An unclosed fence line below a footnote body interrupts the note paragraph and opens a fence in the item. The fence runs to the end of the item, so the blank and the reference after it are payload.

carve
- item
  [^c]: [^d]: para
          more
   ~~~

  See[^c][^d]
html
<ul>
  <li>item
    <pre><code>
See[^c][^d]
</code></pre>
  </li>
</ul>
carve
1. item
   [^c]: para
    ~~~~

   See[^c]
html
<ol>
  <li>item
    <pre><code>
See[^c]
</code></pre>
  </li>
</ol>
carve
:: term
: item
  [^c]: para
   ```

  See[^c]
html
<dl>
  <dt>term</dt>
  <dd>
    <p>item</p>
    <pre><code>
See[^c]
</code></pre>
  </dd>
</dl>

Released under the MIT License.