Why Copying Web Articles Into Markdown Directly Often Leaves Messy HTML
When developers, writers, or researchers copy content from web documentation, Google Docs, or team wikis into Obsidian, GitHub, or Notion, plain-text pasting strips out headings, links, bold text, code blocks, and tables—while raw HTML snippets are cluttered with <div class="...">, inline style="...", and <script> tags.
Cleaning pasted rich text or raw HTML into structured CommonMark + GitHub Flavored Markdown takes two steps:
- Paste rich text or HTML: Click inside the left editor and press
Ctrl+Vto paste formatted content straight from any browser tab (or paste raw<html>markup). - Verify and export: Check the output under Markdown Source or Rendered Preview, then click Copy Markdown or Download
.md.
Standard ATX Headings & GFM Feature Support
Understanding how HTML tags map to standard ATX Markdown keeps your documentation consistent across tools.
How Clipboard Rich-Text Interception Works Safely
Modern browsers place both text/plain and text/html on the clipboard whenever you copy formatted content from a webpage, Feishu doc, or Google Doc.
- Automatic
text/htmlcapture: Onpaste, the editor checksclipboardData.getData('text/html')and loads the structured HTML directly so headings, links, bold runs, and<table>elements are preserved instead of collapsing to plain text. - Plain-text fallback: If you paste raw HTML code from a code editor (where
text/htmlis absent), it converts the pasted markup directly. - 100% client-side privacy: Powered by Turndown, all DOM parsing and rule matching stay strictly inside your browser tab.
Integrating Cleaned Markdown Into Obsidian, Notion, and AI Workflows
- Obsidian & GitHub: Use ATX (
# Heading) mode so H1–H6 headings and GFM tables render uniformly across knowledge bases and repositories. - LLM Context Preparation: Converting bloated webpage HTML into concise Markdown strips out 80%+ of noisy markup tokens before feeding articles to ChatGPT, Claude, or DeepSeek.
Real-World Walkthrough: Converting a Benchmark Web Table Into GFM
Suppose you copy a regional API latency comparison section from an internal dashboard containing an <h1> heading, <strong> emphasis, <del> strikethrough notes, and an HTML <table> with right-aligned numeric columns.
Pasting directly into the left box captures the HTML, strips any embedded <style> rules, and outputs # API Latency Benchmark, **100% locally**, ~~cloud proxy~~, and a clean | Region | P95 (ms) | table with | :--- | ---: |. Switching to Rendered Preview confirms the layout before clicking Download .md.
Under the Hood: Turndown AST & Custom GFM Table Rules
textClipboard text/html or Raw HTML ──▶ Strip <script> / <style> │ ▼ Turndown DOM Walker + GFM Table Rule │ ▼ Clean Markdown + Live Rendered Preview
By removing non-content tags and normalizing cell line breaks into <br> inside GFM tables, the generated Markdown stays compact, readable, and ready for immediate version control.
Tips for Migrating HTML to Clean Markdown
Converting legacy web pages, CMS exports, or rich-text clipboard snippets into Markdown often reveals hidden markup quirks. Paying attention to a few edge cases keeps your migrated .md files clean and easy to maintain in Git:
- Strip Navigation and Boilerplate First: When copying from a live article or pasting full page source,
<script>,<style>, and layout wrappers add noise. Filtering non-content elements before conversion keeps only headings, paragraphs, lists, quotes, and tables. - Prefer ATX Headings and Fenced Code Blocks: ATX headings (
#,##,###) and triple-backtick code fences (```) are universally supported across GitHub, Obsidian, Notion, Astro, and static site generators, making diffs much easier to review than underlined Setext headings. - Check Nested Lists and Inline Code: Rich-text editors such as Google Docs or Word sometimes emit
<span>tags with monospace fonts instead of semantic<code>elements. After conversion, skim code snippets and multi-level bullet lists to confirm indentation matches your target Markdown linter. - Inspect Complex HTML Tables: Standard HTML tables with simple headers convert cleanly into GFM pipe tables, while tables using
rowspanorcolspanmay require manual simplification because Markdown tables do not natively support merged cells.