Last updated
Converting Basic HTML Elements to Markdown
The HTML to Markdown Converter transforms HTML markup into clean Markdown syntax. Here are the most common element conversions:
<!-- HTML input -->
<h1>Main Title</h1>
<h2>Section Heading</h2>
<h3>Subsection</h3>
<p>This is a paragraph with <strong>bold text</strong> and <em>italic text</em>.</p>
<p>Here is <strong><em>bold and italic</em></strong> combined.</p>
<a href="https://example.com">Visit Example</a>
<img src="photo.jpg" alt="A photo of a sunset">
<!-- Markdown output -->
# Main Title
## Section Heading
### Subsection
This is a paragraph with **bold text** and *italic text*.
Here is ***bold and italic*** combined.
[Visit Example](https://example.com)

Converting Lists
Both ordered and unordered lists, including nested structures, convert cleanly to Markdown:
<!-- HTML input -->
<ul>
<li>First item</li>
<li>Second item
<ul>
<li>Nested item A</li>
<li>Nested item B</li>
</ul>
</li>
<li>Third item</li>
</ul>
<ol>
<li>Install dependencies</li>
<li>Configure environment</li>
<li>Run the application</li>
</ol>
<!-- Markdown output -->
- First item
- Second item
- Nested item A
- Nested item B
- Third item
1. Install dependencies
2. Configure environment
3. Run the application
Converting Code Blocks
The converter detects programming language from class attributes and includes it in the fenced code block for syntax highlighting:
<!-- HTML input -->
<p>Use console.log() for debugging.</p>
<pre th:inline="none">
function greet(name) {
return `Hello, ${name}!`;
}
console.log(greet('World'));
def greet(name):
return f"Hello, {name}!"
print(greet("World"))
Use `console.log()` for debugging.
```javascript
function greet(name) {
return `Hello, ${name}!`;
}
console.log(greet('World'));
```
```python
def greet(name):
return f"Hello, {name}!"
print(greet("World"))
```
Converting HTML Tables to Markdown
HTML tables with thead sections convert to GitHub Flavored Markdown table syntax:
<!-- HTML input -->
<table class="data-table">
<thead>
<tr>
<th>Name</th>
<th>Language</th>
<th>Stars</th>
</tr>
</thead>
<tbody>
<tr>
<td>React</td>
<td>JavaScript</td>
<td>220k</td>
</tr>
<tr>
<td>Vue</td>
<td>JavaScript</td>
<td>207k</td>
</tr>
<tr>
<td>Django</td>
<td>Python</td>
<td>78k</td>
</tr>
</tbody>
</table>
<!-- Markdown output -->
| Name | Language | Stars |
|--------|------------|-------|
| React | JavaScript | 220k |
| Vue | JavaScript | 207k |
| Django | Python | 78k |
Converting Blockquotes and Horizontal Rules
Blockquotes and dividers convert to their Markdown equivalents:
<!-- HTML input -->
<blockquote>
<p>The best way to predict the future is to invent it.</p>
<blockquote>
<p>Nested quote for emphasis.</p>
</blockquote>
</blockquote>
<hr>
<p>Content after the divider.</p>
<!-- Markdown output -->
> The best way to predict the future is to invent it.
>
> > Nested quote for emphasis.
---
Content after the divider.
Migrating WordPress Content to Markdown
A common use case is migrating CMS content to a static site generator. Here is a typical WordPress post conversion:
<!-- WordPress HTML export -->
<article>
<h1 class="entry-title">Getting Started with Docker</h1>
<div class="entry-meta">
<time datetime="2024-01-15">January 15, 2024</time>
<span class="author">by <a href="/author/jane">Jane Smith</a></span>
<div class="entry-content">
<p>Docker simplifies application deployment by packaging code and dependencies together.</p>
<h2>Installation</h2>
<p>Download Docker Desktop from the <a href="https://docker.com">official site</a>.</p>
<pre th:inline="none">docker --version
docker run hello-world
Key Concepts
- Image: A read-only template
- Container: A running instance of an image
- Volume: Persistent data storage