Skip to content

Add open-source Markdown to PDF editor - #1

Merged
raj-khan merged 7 commits into
mainfrom
feat/markdown-to-pdf-editor
Jun 21, 2026
Merged

raj-khan merged 7 commits into
mainfrom
feat/markdown-to-pdf-editor

Conversation

@raj-khan

Copy link
Copy Markdown
Owner

Overview

Open-source Markdown → PDF tool — an alternative to markdowntopdf.com with a readme.so-style split editor. Write Markdown with a live preview and download a polished, vector-quality PDF. No sign-up required.

What's included

  • Responsive split editor — Markdown + formatting toolbar beside a live preview on desktop; a Write/Preview tab toggle and a settings popover below lg.
  • High-quality PDF export — /api/pdf renders via headless Chrome (system Chrome locally, @sparticuz/chromium on serverless). Real vector text, syntax highlighting, GitHub-style typography, configurable page size + margins.
  • One shared pipeline — the same unified (remark/rehype) render + CSS drives both the preview and the PDF, so the download always matches the screen. Output is sanitized via rehype-sanitize.
  • Templates + autosave (localStorage), word/char status bar, and a teal design system (deliberately not the default indigo).
  • Optional Supabase scaffold — accounts + a documents table with RLS, inert until env keys are set. The core tool works with zero config.
  • Docs — README, PLAN.md (phased rollout + rationale for staying lean vs. a full SaaS boilerplate), CONTRIBUTING, MIT license, and CI (lint + build).

Tech

Next.js 16 (App Router) · React 19 · Tailwind v4 · zustand · puppeteer-core.

Verification

  • npm run lint and npm run build pass.
  • PDF generation verified end-to-end (valid PDF, correct margins/highlighting).
  • UI checked at 375 / 768 / 1440 px; settings popover and Write/Preview toggle interaction-tested.

Commits

Landed as seven small, focused commits (deps/config, render+PDF engine, API route, editor UI, Supabase scaffold, docs, CI).

raj-khan added 7 commits June 21, 2026 13:30
Add the Markdown pipeline (unified/remark/rehype, highlight.js), PDF
engine (puppeteer-core, @sparticuz/chromium), zustand, lucide-react, and
optional Supabase libraries. Configure Turbopack root, mark the headless
browser packages as server-external, and ignore the generated CSS module
in ESLint.
A single unified pipeline renders Markdown to sanitized HTML for both the
live preview and the PDF, guaranteeing they match. The headless browser
launcher auto-detects a system Chrome locally and uses @sparticuz/chromium
on serverless. PDF stylesheets are vendored into a generated module
(scripts/gen-css.mjs) so they bundle reliably.
POST /api/pdf validates and sanitizes the request, renders the Markdown,
and returns a PDF with configurable page size and margins. Caps payload
size and sanitizes the download filename.
A readme.so-style editor: Markdown source with a formatting toolbar on
one side, live preview on the other. Side-by-side on desktop, with a
Write/Preview tab toggle and a settings popover below lg. Includes
templates, localStorage autosave, a status bar, page metadata, and a
teal design system.
Client/server Supabase helpers that no-op without env keys, plus a
documents table with row-level security. The core tool works fully
without any of this; it only adds optional accounts and cloud sync.
README with quick start and architecture, PLAN.md with the phased
rollout plan and the rationale for staying lean instead of starting from
a full SaaS boilerplate, CONTRIBUTING guide, and MIT license.
Run lint and build on pushes to main and on pull requests.
@raj-khan
raj-khan merged commit b9dbebb into main Jun 21, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant