HTML 转 Markdown:网页片段一键变成干净的 Markdown

HTML to Markdown: Turn Web Snippets into Clean Markdown

什么时候需要把 HTML 转成 Markdown

从网页里复制带格式的文字,粘进编辑器常是一堆 <div>、<span> 和行内样式,又乱又难管。博客搬家、整理他人页面、把富文本邮件转成文本文档时尤其头疼。用 HTML 转 Markdown 工具,粘贴一段 HTML,瞬间得到干净的 Markdown。

转换规则

  • 标题与段落:<h1>–<h6>、<p> 自动映射为 Markdown 的 # 标题与段落。
  • 代码块:<pre><code> 转成带语言标注的围栏代码块,方便语法高亮。
  • 表格:直接生成 GFM 管道式表格,在 GitHub、Typora 等主流 Markdown 里都能正常渲染。
  • 链接、图片、列表、加粗斜体:全部转换为对应的 Markdown 语法,行内样式会被丢弃,输出是纯文本源码。

使用小技巧

不确定流程?点“示例”按钮,工具会填入一段测试 HTML,转换后对照输入输出,很快就能看懂映射关系。转换结果支持一键复制,可直接粘回编辑器。整个过程在浏览器本地进行,粘贴的任何内容都不会上传。

When you need HTML converted to Markdown

Copying formatted text from the web and pasting it into an editor usually drags along a pile of <div>, <span>, and inline styles — messy and hard to manage. That pain shows up when migrating a blog, reusing somebody's page, or turning a rich-text email into a plain document. The HTML to Markdown converter fixes it: paste a snippet, get clean Markdown instantly.

How the conversion works

  • Headings and paragraphs — <h1>–<h6> and <p> map to Markdown headings and paragraphs automatically.
  • Code blocks — <pre><code> becomes fenced blocks with a language hint for syntax highlighting.
  • Tables — output as GFM pipe tables that render correctly on GitHub, Typora, and other mainstream Markdown editors.
  • Links, images, lists, bold, and italics — all become their Markdown equivalents; inline styles are dropped, leaving pure text source.

Pro tips

Not sure how it behaves? Hit the "Example" button — the tool fills in a sample snippet so you can compare input and output and learn the mapping at a glance. Results copy in one click. Everything runs locally in your browser, so pasted content is never uploaded.

Open the tool打开工具