Skip to content
yutils
Example

Input (HTML)

<h1>yutils</h1>
<p>A <strong>simple</strong> tool — converts <em>HTML</em> to <a href="https://yutils.dev">Markdown</a>.</p>
<ul>
  <li>Headings</li>
  <li>Lists (nested OK)</li>
</ul>

Output (Markdown)

# yutils

A **simple** tool — converts *HTML* to [Markdown](https://yutils.dev).

- Headings
- Lists (nested OK)

Note

DOMParser builds an accurate HTML tree → recursive conversion. Attributes (class / style) and script / style tags are deliberately ignored. Verify the result with the Markdown Preview pair tool.

Usage / FAQ

When to use

  • Convert web page or email HTML to Markdown for READMEs / blogs
  • Move CMS-exported HTML to Notion / Obsidian / Markdown-based tools
  • Tidy AI-generated HTML responses into Markdown
  • Migrate legacy HTML docs to modern Markdown pipelines
  • Pair workflow with Markdown Preview for round-trip verification

FAQ

Q.Which HTML elements are supported?
A.Headings (h1-h6), paragraphs, bold / italic / strikethrough, inline + block code, links, images, nested lists (ul / ol), blockquotes, horizontal rules, tables, line breaks. Wrapper elements like div / span are flattened to their content.
Q.What about class / style attributes?
A.Attributes without a direct Markdown counterpart (class / style / id) are dropped. Meaningful ones (href, src, alt, title) are preserved.
Q.How are <script> tags handled?
A.DOMParser parses without executing, so it's safe. Script and style contents are excluded from the output — zero XSS risk.
Fun facts
  • Markdown was created by John Gruber in 2004 as a plain-text → HTML conversion syntax. His design goal: 'Markdown is intended to be as easy-to-read and easy-to-write as is feasible.' The spec was loose enough that many dialects grew; CommonMark (2014) reintroduced a consistent spec.

    Daring Fireball — Markdown
  • HTML → Markdown conversion is always lossy — Markdown's expressivity is a subset of HTML's. Inline styles, classes, nested tables, and custom data attributes either can't be expressed or get passed through as raw HTML. There's a trade-off between 'clean MD' and 'faithful to the source'.

    CommonMark
  • The most widely used HTML → MD library, turndown, was created by Mixmark Studios and has been active since 2017 — yutils uses turndown too. Options like heading style (`#` ATX vs `====` setext) handle dialect differences.

    turndown on GitHub