Transform your Notion workspace into beautiful Docusaurus documentation with full pagination support and rich content preservation.
Nosaurus-Go is a powerful command-line tool that seamlessly converts Notion pages, databases, and blocks into Markdown files optimized for Docusaurus. Perfect for documentation sites, knowledge bases, and content migration from Notion to static site generators.
- π Full Notion API Integration - Complete support for Notion's API with proper pagination handling
- π Rich Content Support - Tables, images, code blocks, callouts, lists, and more
- π Smart Link Resolution - Automatically converts Notion internal links to proper markdown links
- πΌοΈ Image Management - Downloads and organizes images with unique naming
- π Hierarchical Structure - Maintains parent-child relationships and nested content
- β‘ Pagination Handling - Fetches all content beyond Notion's 100-block API limit
- π Debug Mode - Optional detailed logging and API response saving for troubleshooting
- π§ Environment Variables - Secure token management with environment variable support
- Documentation Sites - Convert Notion workspaces to Docusaurus documentation
- Knowledge Bases - Migrate internal wikis from Notion to static sites
- Blog Content - Transform Notion pages into markdown blog posts
- API Documentation - Convert Notion-based API docs to developer-friendly formats
- Team Wikis - Export team knowledge from Notion to searchable documentation
- Go 1.21+ installed on your machine
- Notion API Token - Create an integration
- Root Block/Page ID - The starting point for your content export
# Clone the repository
git clone https://github.com/rafayhingoro/nosaurus-go.git
cd nosaurus-go
# Build the application
go build .
# Make it executable (Linux/Mac)
chmod +x nosaurus-go
# Basic conversion
./nosaurus-go -t your_notion_token -r page_or_database_id
# With custom output directory
./nosaurus-go -t your_notion_token -r page_or_database_id -o ./my-docs
# With debug mode for troubleshooting
./nosaurus-go -t your_notion_token -r page_or_database_id --debug
# Set environment variables for security
export NOTION_API_TOKEN="your_notion_integration_token"
export NOTION_ROOT_ID="your_root_page_or_database_id"
# Run without exposing tokens in command history
./nosaurus-go
Flag | Environment Variable | Default | Description |
---|---|---|---|
-t |
NOTION_API_TOKEN |
- | Notion API integration token (required) |
-r |
NOTION_ROOT_ID |
- | Root page or database ID (required) |
-o |
- | ./output |
Output directory for markdown files |
-docs |
- | /docs |
Root docs directory path for internal links |
-assets |
- | ./static |
Assets directory for images and files |
--debug |
- | false |
Enable debug mode for detailed logging |
# Convert a single page and its subpages
./nosaurus-go -t secret_abc123 -r 1a2b3c4d-5e6f-7890-abcd-ef1234567890
# Convert all pages in a database
./nosaurus-go -t secret_abc123 -r database-id-here -o ./docs
# 1. Create a .env file (don't commit this!)
echo "NOTION_API_TOKEN=secret_abc123" > .env
echo "NOTION_ROOT_ID=1a2b3c4d-5e6f-7890-abcd-ef1234567890" >> .env
# 2. Load environment variables
source .env
# 3. Run the converter
./nosaurus-go -o ./docusaurus/docs --debug
- Go to Notion Integrations
- Click "+ New integration"
- Name your integration (e.g., "Docusaurus Converter")
- Select the workspace
- Copy the Internal Integration Token
- Open your Notion page/database
- Click "Share" in the top right
- Click "Invite"
- Search for your integration name
- Select it and grant access
From URL: https://notion.so/My-Page-1a2b3c4d5e6f7890abcdef1234567890
Page ID: 1a2b3c4d-5e6f-7890-abcd-ef1234567890
Nosaurus-Go creates a well-organized directory structure:
output/
βββ page-title.md # Individual pages
βββ database-pages/ # Database contents
β βββ index.md # Database overview
β βββ _category_.json # Docusaurus category config
β βββ page-1.md # Database entries
βββ nested-content/ # Hierarchical content
β βββ parent-page/
β β βββ index.md
β β βββ child-page.md
βββ static/
βββ docs-images/ # Downloaded images
βββ image1.png
βββ image2.jpg
Enable debug mode to see detailed processing information:
./nosaurus-go -t your_token -r your_id --debug
This creates a debug_responses/
folder with:
- Raw API responses as JSON files
- Detailed pagination information
- Processing logs for each step
"Failed to fetch page content"
# Check your integration has access to the page
# Verify the page ID is correct
# Ensure the integration token is valid
"Rate limited"
# The tool automatically handles rate limiting
# Large exports may take time due to API limits
# Use --debug to monitor progress
"Missing content after certain sections"
# This was a pagination issue - now fixed!
# The tool automatically fetches all content beyond 100 blocks
# Use --debug to verify all pages are fetched
# 1. Backup your existing docs
cp -r docs docs.backup
# 2. Run the converter
./nosaurus-go -o ./docs-notion
# 3. Review and merge content
# 4. Update docusaurus.config.js if needed
# 5. Test your site locally
npm start
Notion Element | Markdown Output |
---|---|
Headings (H1-H3) | # ## ### |
Paragraphs | Standard markdown |
Bold, Italic | **bold** , *italic* |
Code |
Inline code |
Code blocks | Fenced code blocks |
Bulleted lists | - item |
Numbered lists | 1. item |
Tables | HTML tables (Docusaurus compatible) |
Images | Downloaded and linked |
Internal links | Converted to relative paths |
Callouts | Blockquotes with emoji |
We welcome contributions! Here's how to get started:
# 1. Fork the repository
# 2. Clone your fork
git clone https://github.com/yourusername/nosaurus-go.git
# 3. Create a feature branch
git checkout -b feature/your-feature-name
# 4. Make your changes and test
go test ./...
# 5. Submit a pull request
# Install dependencies
go mod tidy
# Run tests
go test -v ./...
# Build for development
go build -o nosaurus-go-dev .
- Small sites (< 50 pages): ~1-2 minutes
- Medium sites (50-200 pages): ~5-10 minutes
- Large sites (200+ pages): ~15-30 minutes
Times vary based on content complexity and API rate limits
- Never commit API tokens to version control
- Use environment variables for tokens
- Rotate tokens regularly in Notion settings
- Limit integration permissions to necessary workspaces
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with β€οΈ using Go
- Inspired by docu-notion
- Enhanced with full pagination support and Go performance
- Thanks to the Notion API team for comprehensive documentation
Made with π¦ by Rafay Hingoro
Star β this repo if it helped you migrate from Notion to Docusaurus!