Skip to content

fazi-gondal/md2pdf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

9 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

An Impressive Markdown to PDF Converter - Privacy-First, Offline-Capable Web Application

Markdown2PDF Preview

- Online Option: Upload resume.md to an unknown server?
+ Try the Offline Web Application instead!

๐Ÿš€ Live Demo โ€ข โœจ Features โ€ข ๐Ÿ›  Tech Stack โ€ข ๐Ÿ“ฆ Installation


๐Ÿ“– Overview

Markdown2PDF is a powerful, privacy-focused web application that converts Markdown files to beautifully formatted PDF documents entirely in your browser. No server uploads, no data tracking - just pure client-side conversion with real-time preview.

๐ŸŒ Try it Live

https://markdownd2pdf.vercel.app/


โœจ Features

๐ŸŽฏ Core Features

  • ๐Ÿ“ File Upload Support - Open and load .md files directly from your computer
  • โœ๏ธ Live Markdown Editor - Real-time editing with syntax highlighting powered by CodeMirror
  • ๐Ÿ‘๏ธ Live Preview - See your markdown rendered instantly as you type
  • ๐Ÿ“„ PDF Export - Convert your markdown to PDF with a single click using the browser's native print functionality
  • ๐Ÿ’พ Save Markdown - Save your edited markdown files with smart filename generation based on document headings
  • ๐Ÿ”’ Privacy First - All processing happens locally in your browser - no server uploads required
  • ๐Ÿ“ฑ Responsive Design - Works seamlessly on desktop and mobile devices with adaptive layouts

๐ŸŽจ Advanced Formatting Support

  • ๐Ÿ“Š Mermaid Diagrams - Create flowcharts, sequence diagrams, and other visualizations
  • ๐Ÿงฎ Mathematical Equations - Full KaTeX support for LaTeX math rendering
  • ๐Ÿ“ GitHub Flavored Markdown - Tables, task lists, and extended markdown syntax
  • ๐Ÿ”” GitHub-Style Alerts - Support for NOTE, TIP, IMPORTANT, WARNING, and CAUTION alerts
  • ๐ŸŽจ Code Syntax Highlighting - Beautiful code blocks with language-specific highlighting
  • ๐ŸŒ™ Dark Mode Editor - VSCode Dark theme for comfortable editing

๐Ÿ–ฅ๏ธ User Experience

  • โšก Fast Performance - Built with Vite for lightning-fast development and optimized production builds
  • ๐ŸŽฏ Smart File Naming - Automatically generates filenames from document headings
  • ๐ŸŒ Print-Optimized - Carefully crafted print styles for professional PDF output
  • ๐Ÿ“‚ Modern File Picker - Native browser file system API support (Chrome/Edge) with fallback for other browsers

๐Ÿ› ๏ธ Tech Stack

Framework & Build Tools

  • โš›๏ธ React 18.2 - Modern UI library with hooks and context API
  • โšก Vite 7.2 - Next-generation frontend build tool for blazing fast development

Styling

  • ๐ŸŽจ Tailwind CSS 3.4 - Utility-first CSS framework for rapid UI development
  • ๐Ÿ”ง PostCSS - CSS processing with autoprefixer

Markdown & Code Editing

  • ๐Ÿ“ CodeMirror 6 - Powerful code editor component
    • @uiw/react-codemirror - React wrapper for CodeMirror
    • @codemirror/lang-markdown - Markdown language support with syntax highlighting
    • @codemirror/language-data - Language support for code blocks
    • @uiw/codemirror-themes-all - VSCode Dark theme and other editor themes

Markdown Rendering

  • ๐Ÿ“„ @uiw/react-markdown-preview - React markdown preview component
  • ๐Ÿงฎ KaTeX - Fast math typesetting library
    • rehype-katex - Rehype plugin for KaTeX math rendering
    • remark-math - Remark plugin for parsing math in markdown
  • ๐Ÿ“Š Mermaid 11.10 - Diagram and flowchart rendering from text

Development Tools

  • โœ… ESLint - Code linting with React-specific rules
  • ๐Ÿ’… Prettier - Code formatting with Tailwind CSS plugin
  • ๐Ÿ” PropTypes - Runtime type checking for React props

๐Ÿ“ฆ Installation

Prerequisites

  • Node.js (v16 or higher)
  • npm or yarn package manager

Setup Instructions

  1. Fork the Repository

    • Click the 'Fork' button on the top right of the GitHub page
  2. Clone Your Fork

    git clone https://github.com/<your-github-username>/md2pdf.git
    cd md2pdf
  3. Install Dependencies

    npm install
  4. Start Development Server

    npm run dev

    The application will be available at http://localhost:5173

  5. Build for Production (Optional)

    npm run build

    The optimized build will be in the dist directory


๐Ÿ‘‰ How to Use

  1. ๐Ÿ“ Open a File - Click the "Open" button to select a .md file from your computer
  2. โœ๏ธ Edit Content - Use the left panel to edit your markdown with syntax highlighting
  3. ๐Ÿ‘๏ธ Preview - Watch the right panel update in real-time as you type
  4. ๐Ÿ’พ Save - Click "Save" to download your edited markdown (with smart filename generation)
  5. ๐ŸŽ‰ Convert to PDF - Click the "PDF" button and choose 'Destination' as Save as PDF

๐Ÿ’ก Pro Tip: Chrome is recommended for the best PDF export results and native file picker support.


๐Ÿ—๏ธ Project Structure

md2pdf-main/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ components/       # React components
โ”‚   โ”‚   โ”œโ”€โ”€ Header.jsx           # App header with actions
โ”‚   โ”‚   โ”œโ”€โ”€ MdEditorComponent.jsx    # CodeMirror editor
โ”‚   โ”‚   โ”œโ”€โ”€ MdPreviewComponent.jsx   # Markdown preview
โ”‚   โ”‚   โ”œโ”€โ”€ Mermaid.jsx             # Mermaid diagram renderer
โ”‚   โ”‚   โ”œโ”€โ”€ FileInput.jsx           # File upload handler
โ”‚   โ”‚   โ””โ”€โ”€ PreviewButton.jsx       # Preview toggle (mobile)
โ”‚   โ”œโ”€โ”€ context/          # React Context for state management
โ”‚   โ”œโ”€โ”€ hooks/            # Custom React hooks
โ”‚   โ”œโ”€โ”€ pages/            # Page components
โ”‚   โ”œโ”€โ”€ utils/            # Utility functions
โ”‚   โ”œโ”€โ”€ App.jsx           # Main app component
โ”‚   โ”œโ”€โ”€ main.jsx          # App entry point
โ”‚   โ””โ”€โ”€ global.css        # Global styles
โ”œโ”€โ”€ public/               # Static assets
โ”œโ”€โ”€ index.html            # HTML template
โ”œโ”€โ”€ tailwind.config.js    # Tailwind configuration
โ”œโ”€โ”€ vite.config.js        # Vite configuration
โ””โ”€โ”€ package.json          # Project dependencies

๐Ÿš€ Available Scripts

Command Description
npm run dev Start development server with hot reload
npm run build Build optimized production bundle
npm run preview Preview production build locally
npm run lint Run ESLint to check code quality

๐ŸŽฏ Key Technologies Explained

Why React + Vite?

  • React provides a component-based architecture for building interactive UIs
  • Vite offers instant server start and lightning-fast Hot Module Replacement (HMR)

Why CodeMirror?

  • Professional-grade code editor with extensive customization
  • Excellent performance with large documents
  • Built-in markdown syntax support

Why Client-Side Only?

  • Privacy - Your documents never leave your browser
  • Offline Capable - Works without an internet connection (after initial load)
  • Fast - No server round trips needed

๐Ÿค Contributing

Contributions are welcome! Feel free to:

  • ๐Ÿ› Report bugs
  • ๐Ÿ’ก Suggest new features
  • ๐Ÿ”ง Submit pull requests

๐Ÿ‘จโ€๐Ÿ’ป Author

Faizan Gondal


๐Ÿ“„ License

This project is licensed under the MIT License - feel free to use it for personal or commercial projects.


Made with โค๏ธ by Faizan Gondal

โญ If you find this project useful, please consider giving it a star on GitHub! โญ

About

Web-based markdown to PDF converter with GitHub Flavored Markdown support, live preview, and one-click export.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published