How does rich clipboard HTML convert without mounting unsafe markup?
When you paste into the Rich paste target box, the handler intercepts text/html directly from the clipboard event instead of letting the browser insert live DOM nodes. A pure TypeScript tokenizer inside a Comlink Web Worker then converts headings, lists, and tables into clean GitHub-Flavored Markdown with zero network uploads.
Under the MDN DataTransfer.getData clipboard API, browsers expose both text/html and text/plain flavors on paste without executing embedded tags. Avoiding a contenteditable mount prevents external CSS rules from bleeding into the workspace and keeps page reflows fast on long docs.
Copied Google Docs selections notoriously wrap entire sections inside <b style="font-weight:normal"> before nesting <span style="font-weight:700"> for real bold words. By reading CSS font-weight values (normal and 400 stay plain; 600 through 1000, bold, and bolder output **text**), HTML to Markdown exports accurate emphasis instead of bolding whole pages. Once extracted, teams prepping LLM prompts often count BPE tokens in converted Markdown to confirm RAG chunk sizing.
GitHub-Flavored Markdown tables, task lists, and code fences
Structured technical documentation relies on syntax defined in the GitHub Flavored Markdown 0.29 Specification, which extends CommonMark with pipe tables, strikethrough (~~), and interactive checklists. Every structural block maps deterministically inside the worker so docs stay valid across GitHub, Obsidian, and static-site generators.
| HTML construct | Default Markdown output | Option toggle or edge-case behavior |
|---|---|---|
table with th / td |
GFM pipe table with alignment dividers | Uncheck GFM pipe tables for pipe-separated lines |
pre + code (language-*) |
Triple-backtick fenced block | Switches to ~~~~ if code contains triple backticks |
input[type="checkbox"] in li |
- [x] or - [ ] task item |
Supports nested ul and ol with 2 spaces per level |
b / span CSS font-weight |
**bold** only on weight >= 600 |
Ignores Google Docs font-weight:normal wrappers |
img with src="data:..." |
[Image: alt] or stripped |
Uncheck Omit base64 data images to retain URI |
Column alignment and pipe escaping inside GFM tables
The table renderer reads thead, tbody, and tfoot sections, aligns column divider rows (---, :---:, ---:) from align attributes or CSS text-align, and pads jagged rows to uniform width. Literal | characters inside cell text escape to \|, while <br> elements inside table cells stay <br> instead of breaking the row.
Unchecking GFM pipe tables switches tables to plain |-separated lines across paragraphs for downstream editors that lack GFM extensions. Teams extracting product spreadsheets or vendor portal grids can also cross-reference shipping and order tables inside a structured ANSI X12 and EDIFACT viewer before importing into databases.
Preserving nested task lists and fenced code blocks
Ordered lists honor explicit start attributes, while nested lists indent 2 spaces per depth level and convert <input type="checkbox"> markers into - [x] or - [ ] task syntax. Clicking Load sample HTML loads a database cutover runbook showcasing Google Docs bold spans, nested task checklists, aligned columns, and SQL code.
For code samples, the converter inspects language-* or lang-* classes on <pre> or <code>, strips leading and trailing blank lines, and chooses dynamic backtick counts for inline code snippets. If a <pre> block already contains triple backticks, the fence upgrades automatically to four tildes (~~~~) so nested Markdown documentation never closes early.
Strip nav and footer boilerplate, void elements, and link safety
Real-world web captures contain broken nesting, legacy attributes, and hidden tracking blocks alongside real prose. Following the WHATWG HTML Living Standard parsing rules, the tokenizer handles all 14 void elements (br, hr, img, input, and peers), auto-closes unclosed <p>, <li>, <td>, and <tr> tags, and decodes named HTML entities cleanly.
Isolating main or article containers from nav chrome
When Strip nav & footer is enabled, the walker looks for <main> first, falls back to <article>, and discards <nav>, <footer>, and <aside> elements before rendering text. Leaving it unchecked preserves full-document structure when converting standalone email newsletters or custom HTML partials.
Non-breaking spaces (\u00a0) normalize into standard ASCII spaces, and excessive blank lines collapse so output never carries awkward gaps around stripped sidebars. Converting cleaned documentation back into office deliverables is straightforward when you need editable Word drafts without inline HTML styles for external reviewers.
Blocking javascript links, style tags, and base64 images
Executable and non-prose elements (script, style, noscript, template, svg, iframe, object, and head) drop completely during HTML conversion before any Markdown is emitted. Every link href and image src passes through isSafeHref(), stripping 32 ASCII control characters (\u0000 to \u0020) and downgrading javascript:, vbscript:, and data:text/html links to inert text.
Toggling Keep hyperlinks or Keep images strips link wrappers or image markdown completely when you only want clean prose. With Omit base64 data images active by default, 100 KB inline base64 screenshots collapse into [Image: alt] tokens instead of bloating repository diffs by 90% or more.
Tip: Run Load sample HTML once and inspect HTML source to see how Strip nav & footer omits top navigation links while keeping the
<main>runbook intact.
When should you edit raw HTML source vs paste directly?
Edit inside HTML source when you need to fix broken markup, drop a single wrapper div, or tweak table attributes across a saved file; paste directly into Rich paste target when copying formatted notes from Google Docs, Notion, or Confluence. Both inputs feed the identical Comlink worker pipeline without saving text to any server.
Reading word, heading, table, and link counts locally
After every click of Convert to Markdown (or instant checkbox change), the output bar displays live badge totals for words, lines, headings, tables, and safe links. Checking those five counts helps catch unintended boilerplate or missing headings before pasting into a CMS or static repository.
Exporting clean .md files for docs and AI pipelines
Clicking Copy Markdown writes clean UTF-8 text to your clipboard, while Download .md exports converted.md tagged with text/markdown;charset=utf-8 per the IETF RFC 7763 Markdown media type. Because zero bytes leave browser memory, private internal wikis and release runbooks stay confidential.
Once your clean .md draft passes inspection, use Clear to purge input and output from component state, or compile finished specifications into paginated handouts with Markdown to PDF right on your device.