Paste GitHub-Flavored Markdown into a Thunderbird HTML compose window and see it rendered instantly as formatted rich text — tables, code blocks with syntax highlighting, task lists, strikethrough, and more, styled to closely match how GitHub renders Markdown.
- Live inline paste rendering — paste Markdown text anywhere in the compose editor and it is immediately converted to formatted HTML in place.
- Toggle button — a toolbar button (and
Ctrl+Alt+M) renders or un-renders the entire draft on demand, for drafts typed directly as Markdown rather than pasted. - GitHub Flavored Markdown (GFM): headings, bold/italic, lists, links,
blockquotes, tables,
~~strikethrough~~, task lists (- [ ]/- [x]), autolinked URLs, and fenced code blocks with syntax highlighting (via highlight.js, GitHub theme). - Safe by design — all rendered HTML is sanitized with
DOMPurify before insertion; no
eval(), no remote code, fully CSP-compliant, no network access needed.
- A background script registers a compose script
(
messenger.composeScripts.register()) that runs inside the live DOM of every compose window. - The compose script listens for native
pasteevents. Pasted plain text is converted to HTML with marked.js (configured with{ gfm: true, breaks: true }to match GitHub's own rendering behavior), sanitized, and inserted at the cursor using theSelection/RangeAPI (cursor position is preserved after insertion). - The compose toolbar button (
compose_action) sends a message to the active compose tab to toggle full-draft rendering. The original Markdown source is preserved in a hidden attribute so the draft can be converted back to source text.
This add-on targets recent Thunderbird versions only (140+) and does not attempt to support older releases.
No Experiment APIs, no legacy XPCOM access, and no clipboardRead
permission are required — clipboard text is read synchronously from the
native paste event, and the rest is standard modern WebExtension APIs.
-
Download or clone this repository.
-
In Thunderbird: Menu → Add-ons and Themes → gear icon → Debug Add-ons.
-
Click Load Temporary Add-on… and select
manifest.jsonfrom this folder. -
Open a new compose window, paste some Markdown, and it should render immediately. Use the toolbar button or
Ctrl+Alt+Mto toggle rendering of the whole draft.Temporary add-ons are removed when Thunderbird restarts. To install permanently, package it as an
.xpi(see below) and use Install Add-on From File… instead — Thunderbird does not require extensions to be signed, so this works out of the box.
Run package.ps1 (Windows PowerShell) from the project root:
./package.ps1This produces markdown-paste.xpi in the project root, ready for
Install Add-on From File…, or for submission to
addons.thunderbird.net (see
ATN_SUBMISSION_GUIDE.md).
- Lint with
web-ext:npx web-ext lint --source-dir . --ignore-files vendor/** icons/**
- Compose script console: while the add-on is loaded temporarily, click the
Inspect link next to it in Debug Add-ons, open a compose window, and
use the DevTools console attached to that window to see logs/errors from
composescript.js.
The tests/ folder and its jsdom devDependency are dev-only — they
are not required to build or run the extension itself (the shipped .xpi
has zero Node.js dependencies, see BUILD.md), and package.ps1 never
includes tests/, node_modules/, package.json, or package-lock.json
in the packaged .xpi.
npm install
npm testThe tests load the actual background.js/composescript.js files (via
jsdom + a stubbed messenger API) rather than reimplementing their logic,
so they exercise the real paste-rendering, whole-draft toggle, and
signature-exclusion behavior end-to-end. See tests/ for coverage of:
single-line vs. multi-line vs. block-level Markdown paste rendering,
render/un-render round-trips, Thunderbird signature exclusion, plain-text
compose mode, composestyles.css scoping, manifest.json validity, and
background.js message wiring.
manifest.json Extension manifest (MV2, MailExtension)
background.js Registers the compose script, handles the toolbar button & command
composescript.js Runs inside the compose editor DOM: paste interception + toggle render
composestyles.css GitHub-like styling for rendered Markdown output
vendor/ Bundled third-party libraries (marked.js, DOMPurify, highlight.js)
icons/ Toolbar/listing icons
tests/ Automated test suite (dev-only, see "Running the automated test suite")
package.ps1 Helper script to zip the extension into an .xpi
ATN_SUBMISSION_GUIDE.md Steps + listing text for submitting to addons.thunderbird.net
MIT — see LICENSE.