MDUtil

HTML to Markdown Converter

Paste HTML from a web page, an email or a CMS and get clean Markdown with headings, lists, tables, code and links. Nothing is uploaded.

HTML

827 characters20 lines
# Getting started with field notes

Field notes keeps your observations **offline** until you are back online. Read the [sync guide](/docs/sync) for details.

![The notes screen](/img/notes.png)

## Install

```bash
npm install field-notes
```

## Options

| Option    | Default |
| --------- | ------: |
| `sync`    |    true |
| `quality` |     0.8 |

- Works *without* a connection
- ~~Manual export~~ is no longer needed

> Tip: sync before a long trip.
457 characters23 lines

How to convert HTML to Markdown

  1. Paste HTML

    Paste HTML source or open an .html file. To convert what you see on a page, copy it into the Rich Text to Markdown converter.

  2. Add the page address

    Enter the address the HTML came from, so relative links and images such as /img/a.png become full URLs.

  3. Copy the Markdown

    Copy the result or download a .md file; the Preview tab shows it rendered.

What it handles

GitHub Flavored Markdown
Tables, task lists, strikethrough and fenced code blocks come out the way GitHub writes them.
Code keeps its language
<pre><code class="language-js"> becomes a fenced block marked js, and highlighting spans are dropped.
Tables found and kept
HTML tables become pipe tables; <th> cells, or else the first row, become the header row.
Links and images
Links and images keep their text and titles, and relative addresses are completed from the page address.
Layout clutter removed
Scripts, styles, comments and wrappers such as <div> and <span> go, and the text inside them stays.
Math and footnotes
KaTeX formulas and MathML that carries its TeX turn back into $…$, and the footnote sections GitHub and Pandoc write become Markdown footnotes.

HTML elements and the Markdown they become

The right-hand column is the converter's own output for each example, with images kept as the page does by default.

ElementHTMLMarkdown
Headings
<h2>Results</h2>
## Results
Bold and italic
<p><strong>bold</strong> and <em>italic</em></p>
**bold** and *italic*
Strikethrough
<p><del>old price</del></p>
~~old price~~
Links
<p><a href="https://mdutil.com">MDUtil</a></p>
[MDUtil](https://mdutil.com)
Lists
<ul>
  <li>Apples</li>
  <li>Pears</li>
</ul>
- Apples
- Pears
Task lists
<ul>
  <li><input type="checkbox" checked> Done</li>
  <li><input type="checkbox"> To do</li>
</ul>
- [x] Done
- [ ] To do
Tables
<table>
  <tr><th>Name</th><th align="right">Score</th></tr>
  <tr><td>Ada</td><td align="right">92</td></tr>
</table>
| Name | Score |
| ---- | ----: |
| Ada  |    92 |
Code
<pre><code class="language-js">console.log("Hello")</code></pre>
```js
console.log("Hello")
```
Line breaks
<p>First line<br>Second line</p>
First line\
Second line
Quotes
<blockquote><p>Quoted text</p></blockquote>
> Quoted text
Images
<img src="https://mdutil.com/logo.svg" alt="Logo">
![Logo](https://mdutil.com/logo.svg)

Convert HTML to Markdown in code

JavaScript

Turndown converts in the browser or in Node. Add the turndown-plugin-gfm plugin for tables and strikethrough.

import TurndownService from "turndown";

const turndown = new TurndownService({ headingStyle: "atx", codeBlockStyle: "fenced" });
const markdown = turndown.turndown("<h1>Hello</h1><p>World</p>");

Python

from markdownify import markdownify

markdown = markdownify(html, heading_style="ATX")

Pandoc

pandoc page.html -f html -t gfm -o page.md

Questions and answers

How do I convert HTML to Markdown?

Paste the HTML above and copy the Markdown on the right, or download it as a .md file. The conversion runs in your browser.

How do I turn a web page into Markdown?

Select the part of the page you want, copy it and paste it into the Rich Text to Markdown converter. To work from the source instead, copy the HTML from the browser's developer tools and paste it here together with the page address.

Why do links and images point nowhere?

The HTML uses relative addresses such as /docs/sync, which only work on their own site. Enter the page address in Page address and they become complete URLs.

What happens to HTML that Markdown cannot express?

Elements with no Markdown syntax, such as <div>, <span> or colored text, are dropped and their text is kept. Use the Markdown result as a clean base and add formatting back where you need it.

Can I convert only an HTML table?

Yes. Paste the <table> here, or use the HTML Table to Markdown converter, which also handles tables copied from spreadsheets.

Is my HTML uploaded anywhere?

No. The conversion runs in your browser, so the HTML never leaves your device.