Skip to main content

Publish Markdown and mkdocs.yml-based documentation into Notion.

Project description

mkdocs2notion

A command-line tool that converts a directory of Markdown documents—optionally structured with mkdocs.yml—into a fully-organized Notion workspace.

This utility mirrors the publishing behavior of MkDocs, but targets Notion pages instead of a static site.

All parsing and conversion logic is implemented natively in this repository, with an adapter layer that can use Ultimate Notion (if installed) or a future Notion SDK integration.


Features

  • 🗂 Publish entire Markdown folders to Notion
  • 📄 Accurate Markdown → Notion block conversion
  • 📚 Optional mkdocs.yml navigation support
  • 🔗 Maintains hierarchical structure and ordering
  • 🆔 Local file-path ↔ page-ID mapping for updates
  • 🛠 Dry-run mode for testing without touching Notion
  • ⚙️ Adapter layer to support different Notion clients

Why This Exists

Markdown is easy to write. Notion is easy to share/control.

But getting a structured Markdown knowledge base into Notion—and keeping it updated—is hard.

mkdocs2notion solves that by:

  • replicating MkDocs’ handling of directories, files, and nav trees,
  • converting Markdown into rich Notion blocks,
  • creating/updating pages while maintaining structure,
  • allowing teams to turn entire docs folders into Notion workspaces.

Installation

mkdocs2notion is not yet on PyPI (until the core APIs stabilize), but you can install it locally:

pip install -e .

Or install from GitHub:

pip install git+https://github.com/mahbam42/mkdocs2notion

Basic Usage

Push a directory to Notion

mkdocs2notion push docs/

With mkdocs.yml navigation

mkdocs2notion push docs/ --mkdocs mkdocs.yml

Dry run (see what would happen)

mkdocs2notion dry-run docs/

Configuration

Environment variables

You will need a Notion API token:

NOTION_TOKEN=your-secret-token

Optional:

NOTION_PARENT_PAGE_ID=...   # where new pages should be created

How It Works

mkdocs2notion processes content in stages:

1. Directory Loader

  • Walks the directory
  • Reads Markdown files
  • Extracts titles (frontmatter or H1)
  • Generates metadata for each page

2. mkdocs.yml Navigation Loader (optional)

  • Reads mkdocs.yml
  • Builds an ordered tree of sections/pages

3. Markdown Parser

  • Converts Markdown into internal block structures
  • Converts those blocks into Notion-ready representations

4. Notion Adapter

A thin abstraction around Notion operations (via Ultimate Notion or another SDK):

  • create/update pages
  • send block updates
  • maintain parent-child relationships

You can swap the adapter without touching the logic.


Project Structure

mkdocs2notion/
│
├── mkdocs2notion/
│   ├── markdown/
│   ├── loaders/
│   ├── notion/
│   ├── cli.py
│   └── runner.py
│
├── tests/
├── pyproject.toml
└── README.md

Roadmap

  • Core Markdown → Notion block converter
  • Directory import with ID mapping
  • mkdocs.yml → hierarchy builder
  • Initial CLI (Typer-based)
  • First Notion adapter using Ultimate Notion
  • Add docs for block coverage
  • Publish PyPI v0.1.0
  • Optional PR to Ultimate Notion with internal modules

Contributing

See agents.md for strict guidelines on:

  • development workflow
  • linting + typing
  • testing (offline + online)
  • commit rules
  • agent behavior

Contributions are welcome—but must follow these standards to maintain reliability.


License

MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mkdocs2notion-0.1.0.tar.gz (28.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mkdocs2notion-0.1.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file mkdocs2notion-0.1.0.tar.gz.

File metadata

  • Download URL: mkdocs2notion-0.1.0.tar.gz
  • Upload date:
  • Size: 28.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for mkdocs2notion-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f9e1bd0d5765af5a9d1f1ef757a07fd90fcb0eb0257d7b77afe42e97183675de
MD5 88854bd29b5f571f81be3bcd2a636045
BLAKE2b-256 9a4d86245cae8b6e27f5617478c937887a951d800d60a85163b885213a9fd5de

See more details on using hashes here.

File details

Details for the file mkdocs2notion-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mkdocs2notion-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6ca311bc03f3b3e8592d17fb427d8e7fe445810f01ffbebf4282cef219abb2f2
MD5 9d751d8de230bb47d73d6fee97204f12
BLAKE2b-256 a5199603a9d7c4f33c9167c9a8eff8de25104878cd074b87da9e3aa38a6e1d28

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page