A Next.js application that converts Notion pages to Markdown with syntax highlighting and PDF export capabilities. Built with React, TypeScript, and the Notion API.
- Convert Notion pages to beautifully formatted Markdown
- Syntax highlighting for code blocks
- Print to PDF functionality
- Copy markdown to clipboard
- Dark mode support for code blocks
- Responsive design
- Server-side processing with Next.js server actions
- Node.js 18+
- A Notion integration token
- Notion pages must be shared with your integration
- Clone the repository:
git clone https://github.com/yourusername/notion-to-markdown-pdf.git
cd notion-to-markdown-pdf- Install dependencies:
npm install- Create a
.envfile in the root directory with your Notion API key:
NOTION_API_KEY=your_notion_api_key- Copy the URL of a Notion page that's shared with your integration
- Paste the URL into the converter
- Click "Convert to Markdown"
- You can then:
- View the formatted markdown with syntax highlighting
- Copy the raw markdown to clipboard
- Print the document to PDF
notion-export/
├── src/
│ ├── app/
│ │ ├── actions/
│ │ │ └── notion.ts # Server actions for Notion conversion
│ │ ├── components/
│ │ │ └── NotionConverter.tsx # Main converter component
│ │ └── page.tsx # Main page component
├── public/
│ └── tmp/ # Temporary storage for generated files
├── .env.local # Environment variables
└── package.json
- Next.js - React framework with server actions
- @notionhq/client - Official Notion API client
- notion-to-md - Converts Notion blocks to markdown
- react-markdown - Renders markdown as React components
- react-syntax-highlighter - Code syntax highlighting
- remark-gfm - GitHub Flavored Markdown support
To contribute:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
MIT License - feel free to use this project as you wish.
For issues and feature requests, please use the GitHub issues page.