Skip to content

DRAMV/md-converter-extension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

MD Converter

MD Converter

Convert any webpage, PDF, screenshot, image, or Office document into clean Markdown β€” instantly, right from your browser.

Manifest V3 Gemini AI Free Tier License: MIT Version


Overview

MD Converter is a Chrome browser extension powered by Google Gemini AI that converts virtually anything on the web into clean, well-structured Markdown. From screenshots and scanned documents to PDFs, Office files, and handwritten notes β€” MD Converter intelligently analyses the content type and applies the most effective conversion strategy automatically.

No subscriptions. No credit card. Built entirely on Google's free API tier.


Features

Core Capture Modes

Feature Description
πŸ“· Snap Area Draw a selection box on any part of the page and convert just that region
πŸ–Ό Full Screenshot Capture the entire visible page and convert it to Markdown
πŸ“„ Page Text Extract the readable content from any webpage, stripping ads, nav, and boilerplate
πŸ“Ž Upload File Upload PDFs, images, Office documents, or text files directly for conversion

Deep Image Conversion

The standout feature of MD Converter is its intelligent image analysis engine. Rather than using a single generic prompt for every image, the extension automatically detects the image subtype and applies a specialised conversion strategy optimised for that content.

11 supported image subtypes:

Subtype Detection Trigger Optimised For
πŸ–₯ Screenshot Filename contains screen, wide dimensions Web content, UI, code snippets
πŸ“„ Scanned Document Filename contains scan, ocr Physical documents, forms, OCR accuracy
✍️ Handwriting Filename contains handwrit, note Handwritten notes, ambiguity markers
πŸ“Š Table / Data Filename contains table, data Structured data β†’ Markdown tables
πŸ“ˆ Chart / Graph Filename contains chart, graph Data extraction, trend description
πŸ”· Diagram Filename contains diagram, flow Flowcharts, architecture, components
πŸ–Ό Slide Filename contains slide, ppt Presentation slides, speaker notes
🧾 Receipt / Invoice Filename contains receipt, invoice Financial documents, line item tables
πŸ“– Document Page Tall portrait orientation Books, reports, footnotes
πŸ“· Photo Square-ish, general imagery Text extraction, scene description
🏷 Banner Wide landscape orientation Headers, taglines, CTAs

How detection works:

  1. Filename keyword matching (highest priority)
  2. Image dimension and aspect ratio analysis as fallback
  3. Resolution heuristics for final determination

Each subtype maps to a dedicated Gemini prompt engineered to extract maximum structure and accuracy from that content category.

Office File Support

MD Converter processes Office documents client-side before sending to Gemini, meaning the raw file bytes never leave your browser unprocessed:

Format Parser What's Preserved
.docx mammoth.js Headings, lists, tables, bold/italic, code blocks
.xlsx / .xls SheetJS All sheets as Markdown tables with headers
.pptx SheetJS zip parser Slide-by-slide text with ## headings

Output & UX Features

Feature Description
✏️ Preview & Edit Edit the Markdown output directly in the sidebar before saving
πŸ“ Rename Output Click the filename in the preview toolbar to rename it inline
πŸ“₯ Download .md Save as a properly named Markdown file
πŸ“‹ Copy to Clipboard One-click copy for pasting directly into any editor
πŸ”’ Word & Char Count Live counter updates as you edit the output
πŸ”” PDF Auto-detect Toast notification when a PDF tab opens β€” one click to convert
βš™οΈ Settings Page Full options page with API key, model, filename template, theme, and token controls
πŸŒ™ Dark Mode Auto-detects system theme or manually selectable

Installation

Prerequisites

  • Google Chrome (or any Chromium-based browser)
  • A free Google Gemini API key β€” get one here (no credit card required)

Steps

1. Clone the repository

git clone https://github.com/DRAMV/md-converter-extension.git
cd md-converter-extension

2. Install library dependencies

mkdir -p libs
curl -L -o libs/mammoth.min.js https://cdn.jsdelivr.net/npm/mammoth/mammoth.browser.min.js
curl -L -o libs/xlsx.min.js https://cdn.jsdelivr.net/npm/xlsx/dist/xlsx.full.min.js
curl -L -o libs/marked.min.js https://cdn.jsdelivr.net/npm/marked/marked.min.js

3. Load in Chrome

  1. Go to chrome://extensions
  2. Enable Developer mode (toggle, top-right)
  3. Click Load unpacked
  4. Select the md-converter-extension folder
  5. The extension icon appears in your toolbar

4. Add your API key

  1. Click the MD Converter icon
  2. Paste your Gemini API key
  3. Click Save key β€” stored once, persists forever

Usage

Image Conversion (Deep Mode)

Upload any image via πŸ“Ž Upload file and the extension will:

  1. Analyse the filename for subtype hints
  2. Fall back to dimension and ratio analysis if no hints found
  3. Display the detected subtype: Detected: Receipt / invoice β€” converting...
  4. Send the image to Gemini with the optimised prompt for that subtype

To force a specific subtype, rename the file before uploading:

invoice-001.png     β†’ Receipt / invoice prompt
chart-revenue.png   β†’ Chart / graph prompt
scan-report.jpg     β†’ Scanned document prompt
table-data.png      β†’ Table extraction prompt
diagram-flow.png    β†’ Diagram / flowchart prompt
slide-01.png        β†’ Presentation slide prompt
handwritten-notes.jpg β†’ Handwriting transcription prompt

PDF Auto-detect

When you open any .pdf URL in Chrome, a toast notification appears bottom-right asking "Convert this PDF to Markdown?" β€” click Convert to Markdown and the sidebar opens with the conversion running automatically.

This can be enabled or disabled under βš™οΈ Settings β†’ Capture β†’ PDF Auto-detect.

Settings Page

Access via the extension popup β†’ βš™οΈ Settings, or via chrome://extensions β†’ MD Converter β†’ Details β†’ Extension options.

Setting Options
API Key Paste, test, and manage your Gemini key
AI Model gemini-2.5-flash-lite / gemini-2.5-flash / gemini-2.0-flash
Filename Template {date}-{title}, {time}-{title}, custom patterns
Theme Light / Dark / System
Default Capture Mode Area / Full screenshot / Page text / Upload
PDF Auto-detect Enable / Disable toast notification
Max Output Tokens 1K – 65K slider (default 8192)
Temperature 0 (accurate) – 1 (creative) slider

Project Structure

md-converter-extension/
β”‚
β”œβ”€β”€ manifest.json                  # Extension config (Manifest V3)
β”œβ”€β”€ background.js                  # Service worker β€” API calls, tab capture, downloads
β”œβ”€β”€ content.js                     # Injected into pages β€” sidebar, toast, area selection
β”‚
β”œβ”€β”€ popup/
β”‚   β”œβ”€β”€ popup.html                 # Toolbar popup UI
β”‚   β”œβ”€β”€ popup.js                   # API key management, sidebar toggle, settings link
β”‚   └── popup.css                  # Popup styles
β”‚
β”œβ”€β”€ sidebar/
β”‚   β”œβ”€β”€ sidebar.html               # Sidebar panel UI
β”‚   β”œβ”€β”€ sidebar.js                 # All sidebar logic β€” capture, conversion, preview
β”‚   └── sidebar.css                # Sidebar styles + dark theme variables
β”‚
β”œβ”€β”€ options/
β”‚   β”œβ”€β”€ options.html               # Full settings page UI
β”‚   β”œβ”€β”€ options.js                 # Settings logic β€” save, test key, reset, storage stats
β”‚   └── options.css                # Settings page styles
β”‚
β”œβ”€β”€ toast/
β”‚   β”œβ”€β”€ toast.html                 # PDF detection toast notification
β”‚   β”œβ”€β”€ toast.js                   # Auto-dismiss countdown, convert/dismiss handlers
β”‚   └── toast.css                  # Toast animation and styles
β”‚
β”œβ”€β”€ utils/
β”‚   β”œβ”€β”€ converter.js               # File type detection, image subtype detection, file readers
β”‚   β”œβ”€β”€ image-analyzer.js          # 11 specialised Gemini prompts per image subtype
β”‚   └── office-converter.js        # Client-side DOCX/XLSX/PPTX parsing (mammoth + SheetJS)
β”‚
β”œβ”€β”€ libs/
β”‚   β”œβ”€β”€ mammoth.min.js             # DOCX β†’ HTML parser
β”‚   β”œβ”€β”€ xlsx.min.js                # XLSX/XLS/PPTX parser (SheetJS)
β”‚   └── marked.min.js              # Markdown renderer
β”‚
β”œβ”€β”€ icons/
β”‚   β”œβ”€β”€ icon16.png
β”‚   β”œβ”€β”€ icon48.png
β”‚   └── icon128.png
β”‚
└── .github/
    └── workflows/
        └── build.yml              # GitHub Actions β€” auto-packages extension on push

API & Rate Limits

Built on the Google Gemini API free tier β€” no billing required.

Model Requests/min Requests/day Context Window
gemini-2.5-flash-lite βœ… Default 15 1,000 1M tokens
gemini-2.5-flash 10 500 1M tokens
gemini-2.0-flash 15 1,500 1M tokens

Get your free key at aistudio.google.com/apikey β†’ Create API key in new project


Supported File Types

Category Formats Processing
Images PNG, JPG, JPEG, WEBP, GIF, TIFF, BMP Deep subtype detection + 11 specialised Gemini prompts
PDF PDF Direct Gemini document API + auto-detect toast
Word DOCX mammoth.js client-side parsing β†’ Gemini cleanup
Spreadsheet XLSX, XLS SheetJS client-side parsing β†’ Markdown tables
Presentation PPTX SheetJS zip extraction β†’ slide-by-slide Markdown
Text TXT, MD, CSV, HTML Direct text extraction
Audio/Video MP3, MP4, WAV, OGG, WEBM, M4A Transcript structuring via Gemini
Max file size 20 MB per file β€”

Tech Stack

Layer Technology
Extension platform Chrome Manifest V3
AI engine Google Gemini 2.5 Flash Lite
Image analysis Custom heuristic engine (11 subtypes)
Office parsing mammoth.js (DOCX) + SheetJS (XLSX/PPTX)
Markdown rendering marked.js
Language Vanilla JavaScript β€” no build step required
CI/CD GitHub Actions

Troubleshooting

Sidebar won't open Navigate to a regular webpage first β€” the sidebar cannot open on chrome:// or chrome-extension:// pages.

Scripts not loading / functions undefined Go to chrome://extensions β†’ reload MD Converter β†’ reopen the sidebar. If the issue persists, right-click the sidebar β†’ Inspect β†’ Console and check for red errors.

API key not saving Paste the full key and click Save key. Keys from Google AI Studio start with AQ. or AIza and are stored in chrome.storage.sync automatically.

Quota exceeded error Your key was likely created in a restricted project. Go to aistudio.google.com/apikey β†’ Create API key in new project and use the new key.

Image subtype not detecting correctly Rename the file with a keyword hint before uploading. For example, rename IMG_001.jpg to invoice-001.jpg to force the receipt/invoice prompt.

DOCX/XLSX/PPTX conversion fails Ensure libs/mammoth.min.js and libs/xlsx.min.js exist in the libs/ folder and are listed in web_accessible_resources inside manifest.json.


Contributing

# Fork the repo, then clone your fork
git clone https://github.com/YOUR_USERNAME/md-converter-extension.git

# Create a feature branch
git checkout -b feature/your-feature-name

# Make your changes, then commit
git add .
git commit -m "feat: describe your change"

# Push and open a Pull Request
git push origin feature/your-feature-name

Roadmap

  • Markdown preview renderer (Raw ↔ Rendered toggle)
  • Conversion history panel (IndexedDB)
  • Keyboard shortcuts (Alt+Shift+S, Alt+Shift+F, etc.)
  • Right-click context menu integration
  • Batch conversion with ZIP download
  • Multiple AI providers (Groq, Ollama, OpenAI)
  • Google Drive / Notion / Obsidian integration
  • Chrome Web Store publishing
  • Firefox support (Manifest V2)

If MD Converter saves you time or helps your workflow, consider buying me a coffee or sponsoring me on GitHub. Your support helps me keep the extension updated and maintain the API costs!

Buy Me A Coffee ❀GitHub Sponsors

License

This project is licensed under the MIT License β€” see the LICENSE file for details.


Built with ❀️ using Google Gemini AI  ·  Free to use  ·  No tracking  ·  No ads

⭐ Star this repo if you find it useful

About

AI-powered Chrome extension that converts any webpage, PDF, image, or Office file to Markdown using Google Gemini. Free tier. No credit card.

Topics

Resources

License

Stars

2 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors