A Chrome MV3 extension and local TypeScript service for turning ChatGPT responses into polished, editable PDFs.
Lemon adds an export workflow directly to ChatGPT, opens a full-screen editor for final adjustments, and generates PDFs with configurable typography, pagination, borders, density, and mixed RTL/LTR content.
- Chrome Manifest V3 extension with content-script UI injection
- Full-screen editor for editing generated content before export
- Mixed Persian/English RTL and LTR support, including per-line direction controls
- Local Express API for Markdown/HTML-to-PDF rendering
- TypeScript monorepo with shared development scripts
- Configurable page layout, font size, density, borders, page numbers, and pagination
- Build, test, lint, and type-check workflows
- Separation between browser UX and document-rendering service
TypeScript · Chrome Extension MV3 · Node.js · Express · HTML/CSS · Markdown · PDF generation · npm workspaces
ChatGPT page
│
▼
Chrome MV3 extension
├── injects Export PDF action
├── collects response content
├── opens export settings
└── launches advanced editor
│
▼
Local Express service
├── validates Markdown / HTML
├── applies layout options
└── renders final PDF
- In-page Export PDF action
- Direct export or advanced editing workflow
- Font selection from a bundled Persian font set
- Automatic or manual document direction
- Per-line RTL/LTR controls
- Smart pagination and optional page borders
- Configurable page numbers, density, and font size
- HTML-mode export so the PDF matches edited content
packages/
extension/ # Chrome MV3 extension
service/ # Express PDF-generation API
package.json # workspace scripts
.env.example # service and extension configuration
- Node.js 20+
- npm 10+
- Google Chrome or another Chromium-based browser
npm install
cp .env.example .envnpm run devQuality checks:
npm run build
npm run test
npm run lint
npm run typecheck-
Build the extension:
npm run build:extension
-
Open
chrome://extensions. -
Enable Developer mode.
-
Choose Load unpacked.
-
Select
packages/extension/dist. -
Open ChatGPT and use the injected export action.
GET /healthPOST /api/v1/markdown-to-pdfExample payload:
{
"markdown": "# Hello",
"title": "Example document",
"filename": "example.pdf",
"options": {
"direction": "auto",
"pageNumbers": true,
"pageBorder": true,
"smartPagination": true,
"fontSize": "medium",
"density": "normal",
"codeWrap": false
}
}When html is supplied, the service renders the edited HTML directly. Otherwise, markdown is required.
The root .env controls both services. Important variables include:
SERVICE_PORTSERVICE_MAX_MARKDOWN_LENGTHSERVICE_JSON_BODY_LIMITSERVICE_ALLOWED_ORIGINSSERVICE_ALLOW_CHROME_EXTENSION_ORIGINSEXTENSION_API_BASE_URLEXTENSION_FILENAME_PREFIX
- Start the service with
npm run dev:service. - Build and reload the extension.
- Open a ChatGPT response and select Export PDF.
- Change layout settings and export directly.
- Repeat with Full Editor.
- Edit text, font, and direction settings.
- Confirm the final PDF matches the edited document.
Lemon is designed around a local rendering service. Before exposing that service beyond localhost:
- restrict allowed origins
- set request size limits
- validate HTML and filenames
- place the API behind authentication
- avoid logging private document content
Lemon demonstrates browser-extension engineering, TypeScript monorepo organization, full-stack API integration, document rendering, and multilingual UI design.