The converter produces accurate outputs.
This allows the conversion of entire websites — useful for website migrations and other tasks.
For this to work, many egde-cases have to be considered:
Heading
The converter can handle Headings from level <h1> to <h6> even with other elements inside.
<h2>Heading</h2>
## Heading
<h4>
<strong>Important</strong>
Heading
</h4>
#### **Important** Heading
Bold & Italic
Emphasis and strong formatting is supported – even intraword.
<p>
<strong>Bold</strong>
and
<em>Italic</em>
</p>
**Bold** and *Italic*
Bold & Italic with Nesting
Unnecessary nesting could generate too many * or _ delimiters. The converter reduces unnecessary nesting.
<b><b>Incredibly</b> <b>Bold</b></b>
**Incredibly Bold**
Unordered List
Nested Lists (with the correct indentation) are also supported.
<ul>
<li>Simple List</li>
<li>
<p>Someone once said:</p>
<blockquote>
My famous quote
</blockquote>
<span>by someone</span>
</li>
</ul>
- Simple List
- Someone once said:
> My famous quote
by someone
Ordered List
The start attribute is also respected for ordered lists.
<ol start="9">
<li>Nine</li>
<li>Ten</li>
<li>
Eleven
<ul>
<li>Nested</li>
</ul>
</li>
</ol>
09. Nine
10. Ten
11. Eleven
- Nested
Blockquote
A blockquote can also contain other elements. And blockquotes can event be nested inside each other.
<blockquote>
<h2>Heading</h2>
<ol>
<li>List</li>
<li>List</li>
</ol>
<blockquote>
<p>Another Quote</p>
<p>by someone</p>
</blockquote>
</blockquote>
> ## Heading
>
> 1. List
> 2. List
>
> > Another Quote
> >
> > by someone
Inline Code
The converter correctly treats the backtick character.
<p>
Output a message: <br/>
<code>console.log("hello")</code>
</p>
Output a message:
`console.log("hello")`
<code>with `` backticks</code>
```with `` backticks```
<code>`variable`</code>
`` `variable` ``
Code Block
<pre class="language-js"><code>
console.log("hello")
</code></pre>
```js
console.log("hello")
```
<pre class="language-go"><code>
<span class="token function">func</span>
</code></pre>
```go
func
```
<pre><code>
This ``
totally ``` works!
</code></pre>
````
This ``
totally ``` works!
````
Link
The converter supports relative and absolute links. Other elements inside are also supported.
<a href="/index.html">
<strong>Home</strong>
</a>
[**Home**](/index.html)
<a
href="/about"
title="title text"
>
About
</a>
[About](/about "title text")
Multiline Link
A markdown link can stretch onto multiple lines. For this a blank line has to be escaped.
<a href="/post">
<p>Line 1</p>
<p>Line 2</p>
<p>Line 3</p>
</a>
[Line 1
\
Line 2
\
Line 3](/post)
<a href="/post">
Line 1 <br/>
Line 2 <br/>
Line 3 <br/>
</a>
[Line 1
\
Line 2
\
Line 3](/post)
Escaping where nessesary
Some characters would (accidentally) be recognized as markdown. The converter escapes these with a backlash — but only if nessesary.
<h2># Heading #</h2>
## # Heading \#
<p># Heading</p>
<p>#hashtag</p>
\# Heading
#hashtag
<p>- List Item</p>
<p>Just a — dash</p>
\- List Item
Just a — dash
Swapping Nodes
It is invalid to have block-elements inside inline-elements. The converter then swaps the nodes.
<h2>
<a href="/">Headline</a>
</h2>
## [Headline](/)
<a href="/">
<h2>Headline</h2>
</a>
## [Headline](/)