supermarkdown

Edge Cases

How supermarkdown handles tricky conversions.

Character Escaping

Special Markdown characters are escaped when needed:

CharacterContextEscaped
*In text\*
_In text\_
[In text\[
]In text\]
`In codeUses more backticks
``In tables

Example:

<p>5 * 3 = 15</p>
<p>See [section A] for details.</p>
5 \* 3 = 15

See \[section A\] for details.

Lists

Ordered List Start

The start attribute is preserved:

<ol start="5">
  <li>Five</li>
  <li>Six</li>
</ol>
5. Five
6. Six

Nested Lists

Deep nesting is fully supported:

<ul>
  <li>Item
    <ul>
      <li>Nested
        <ol>
          <li>Deep</li>
        </ol>
      </li>
    </ul>
  </li>
</ul>

Block Content in Lists

Paragraphs and code blocks in list items work correctly with proper indentation.

Code Blocks

Language Detection

Languages are detected from multiple class patterns:

  • language-javascript
  • lang-javascript
  • highlight-javascript
  • hljs language-javascript

Backticks in Code

When code contains backticks, more backticks are used:

<code>Use `template` literals</code>

Outputs: `` Use `template` literals ``

Line Number Gutters

Line number spans (common in syntax highlighters) are automatically removed.

Empty href

Links with empty or missing href become plain text:

<a href="">Click here</a>
Click here

Special Characters in URLs

URLs are properly percent-encoded:

<a href="https://example.com/path with spaces">Link</a>
[Link](https://example.com/path%20with%20spaces)

Email addresses and URLs can become autolinks:

<a href="mailto:test@example.com">test@example.com</a>
<test@example.com>

Limitations

FeatureBehavior
colspan/rowspanFirst cell content only
Nested tablesFlattened
FormsSkipped
iframe/videoPlaceholder text
SVGSkipped
MathMLPreserved as HTML