Skip to main content

marknotion

Bidirectional Markdown ↔ Notion converter with CLI tools.

Installation

# With uv (recommended for CLI tools)
uv tool install marknotion

# Or with pip
pip install marknotion

Setup

1. Create a Notion Integration

  1. Go to Notion Integrations
  2. Click "New integration"
  3. Give it a name (e.g., "marknotion")
  4. Select capabilities: Read, Update, Insert content
  5. Copy the "Internal Integration Token"

2. Set Environment Variable

export NOTION_TOKEN="secret_xxxxx..."

Or create a .env file in your project:

NOTION_TOKEN=secret_xxxxx...

3. Connect Pages to Your Integration

In Notion, open the page you want to access, click "..." menu → "Connections" → Add your integration.

CLI Commands

md2notion - Upload Markdown to Notion

# Update an existing page
md2notion README.md --page "https://notion.so/My-Page-abc123..."

# Create a new child page
md2notion guide.md --parent "abc123..." --title "User Guide"

notion2md - Export Notion to Markdown

# Print to stdout
notion2md "https://notion.so/My-Page-abc123..."

# Save to file
notion2md abc123... -o exported.md

notion-search - Search Notion Pages and Databases

# Search all (pages and databases)
notion-search "project"

# Search only databases (useful for finding database IDs)
notion-search "tracker" --type database

# Search only pages
notion-search "notes" --type page

# Limit results
notion-search project -n 5

Output includes type, ID, and clickable URL:

[Database] Projects
           ID:  1d73963f-ce05-8183-9af4-000b16a57189
           URL: https://www.notion.so/1d73963fce05813bac29eba023f0dd25

[Page]     Meeting Notes
           ID:  abc123de-f456-7890-1234-56789012abcd
           URL: https://www.notion.so/Meeting-Notes-abc123def4567890123456789012abcd

Python API

from marknotion import markdown_to_blocks, blocks_to_markdown, NotionClient

# Convert Markdown to Notion blocks
blocks = markdown_to_blocks("# Hello\n\nWorld")

# Convert Notion blocks to Markdown
md = blocks_to_markdown(blocks)

# Use NotionClient for API operations
client = NotionClient()  # Uses NOTION_TOKEN env var
client.update_page_content_from_markdown(page_id, markdown)

Supported Features

  • Headings (h1-h3)
  • Paragraphs
  • Bold, italic, strikethrough, inline code
  • Links
  • Bullet lists, numbered lists, nested lists, and task lists
  • Tables
  • Code blocks (with language normalization and long block splitting)
  • Blockquotes
  • Horizontal rules
  • Images
  • Math equations (inline and block)
  • Callouts/admonitions
  • Footnotes
  • YAML front matter

License

MIT

Metadata

Release files for marknotion 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for marknotion 0.5.1
File Size Uploaded Provenance Actions
marknotion-0.5.1.tar.gz 36.6 kB With provenance Details for marknotion-0.5.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for marknotion 0.5.1
File Interpreter ABI Platform Actions
marknotion-0.5.1-py3-none-any.whl Python 3 none any Details for marknotion-0.5.1-py3-none-any.whl

Total release size: 56.6 kB

Release files / marknotion-0.5.1.tar.gz

Download URL marknotion-0.5.1.tar.gz
Size 36.6 kB
Tags Source
SHA-256 checksum
How to use checksums
273ae165b2cbcff71d42ebc33559df8e4bacf39b5dace3a0333d61268d1f2373
BLAKE2b-256 checksum
How to use checksums
37c7d532532dffae8b77c79be771844f0f431adab71a62ec9bd02a3e7f584217
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 26, 2026.

Transparency log

Release files / marknotion-0.5.1-py3-none-any.whl

Download URL marknotion-0.5.1-py3-none-any.whl
Size 20.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c10c423249536f4b4fa75544707c9553bc052675c6d072fc607d14687a72eec6
BLAKE2b-256 checksum
How to use checksums
059cce37a93516b6006ddff2a2970d21f0998606d0334b952de8ee4de23c32aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 26, 2026.

Transparency log

Security for marknotion 0.5.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for marknotion-0.5.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page