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 NotionToMarkdown
from notion_client import Client
notion = Client(auth="your-auth-token")
n2m = NotionToMarkdown(notion)
md_str = n2m.GetMarkdownString("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 NotionToMarkdownAsync
notion = AsyncClient(auth="your-auth-token")
n2m = NotionToMarkdownAsync(notion)
md_str = n2m.GetMarkdownStringAsync("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
- Create an integration in your Notion account and get the
API key. - Share your database with the integration to allow access.
- Retrieve your
Database IDandPage IDfrom 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.
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Submit a pull request with a clear description of your changes.
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file notion_to_markdown-0.1.4.tar.gz.
File metadata
- Download URL: notion_to_markdown-0.1.4.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7c20d33df325fedd1e45522c70f38f735d2b54283d401894b9cc577b0f1db1b
|
|
| MD5 |
5239911666ed00bb4fb9d45dd1e88c9b
|
|
| BLAKE2b-256 |
cfa93126f82b6f276aa8ecb5456fb6977d4d5cef40e168283fefc991f6788995
|
File details
Details for the file notion_to_markdown-0.1.4-py3-none-any.whl.
File metadata
- Download URL: notion_to_markdown-0.1.4-py3-none-any.whl
- Upload date:
- Size: 12.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a3572b9e7775c98f5d8954fd8e8823290da11b0278df29f54fcfc7f692df0dd
|
|
| MD5 |
dcf9754ad2b24e6a36bf6a10cc6a5fe7
|
|
| BLAKE2b-256 |
2cf336e1b62ae9c7ec050536fd57e707c68ed4cdd47cc6cd6b3877deb7f75c59
|