Skip to main content

A package to convert Notion content into Markdown format

Project description

Notion to Markdown (Python Version)

The original author of this work is Wei Xiang, please go to the original repository for more details.

I have only audited the code for usage within my company and made minor changes for compatibility with my code.


This is the Python implementation of nodejs version of notion-to-md, a tool that converts Notion pages into Markdown files.

Installation

Install the package via pip:

pip install notion-to-markdown

Usage

Sync Version

from notion_to_markdown import MarkdownProvider
from notion_client import Client

notion = Client(auth="your-auth-token")
n2m = MarkdownProvider(notion)
md_str = n2m.get_markdown_string("page-id")

with open("output.md", "w") as f:
    f.write(md_str)

Async Version

from notion_client import AsyncClient
from notion_to_markdown import MarkdownProvider

notion = AsyncClient(auth="your-auth-token")
n2m = MarkdownProvider(notion)
md_str = n2m.get_markdown_string_async("page-id")

with open("output.md", "w") as f:
    f.write(md_str)

Replace your-auth-token and page-id with the appropriate values from your Notion account.

Authentication with Notion API

  1. Create an integration in your Notion account and get the API key.
  2. Share your database with the integration to allow access.
  3. Retrieve your Database ID and Page ID from the Notion app.

Requirements

  • Python 3.7 or later
  • Notion API key

Limitations

  • The tool relies on the Notion API, and features are limited to what the API supports.
  • Embedding or downloading files other than images is not supported.

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests to improve the functionality or fix bugs.

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Submit a pull request with a clear description of your changes.

License

This project is licensed under the 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

notion_to_markdown-0.1.5.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

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

notion_to_markdown-0.1.5-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file notion_to_markdown-0.1.5.tar.gz.

File metadata

  • Download URL: notion_to_markdown-0.1.5.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for notion_to_markdown-0.1.5.tar.gz
Algorithm Hash digest
SHA256 3caaea2156454c1b9a5716b4d0c4bbe1ab9954f954f19425c0d7343ba4fd2b01
MD5 bb4ff0ae6ace2f054d707b691611fc01
BLAKE2b-256 92fed6996fc2dc30ba3480ad2bb5581341ca0de424f5c43560406d8b0fa58d3c

See more details on using hashes here.

File details

Details for the file notion_to_markdown-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for notion_to_markdown-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d6e9f4eb31681fdcc548df3d4ab37a7858d31d3ea25335930ef8d679029969b7
MD5 792a92cc8b57d1cec7d5ffc6df5bc640
BLAKE2b-256 563e7663e67e3b4eecf78182071ce4a502c84e1cab0a919afbf5e5af6882391c

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