notion-to-md (Python Version)
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-md-py
Usage
Sync Version
from notion_client import Client
from notion_to_md import NotionToMarkdown
notion = Client(auth="your-auth-token")
n2m = NotionToMarkdown(notion)
# Export a page as a markdown blocks
md_blocks = n2m.page_to_markdown("page-id")
# Convert markdown blocks to string
md_str = n2m.to_markdown_string(md_blocks).get('parent')
# Write to a file
with open("output.md", "w") as f:
f.write(md_str)
Async Version
import asyncio
from notion_client import AsyncClient
from notion_to_md import NotionToMarkdownAsync
notion = AsyncClient(auth="your-auth-token")
n2m = NotionToMarkdownAsync(notion)
# Export a page as a markdown blocks
md_blocks = asyncio.run(n2m.page_to_markdown("page-id"))
# Convert markdown blocks to string
md_str = n2m.to_markdown_string(md_blocks).get('parent')
# Write to a file
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.
Metadata
Release files for notion-to-md-py 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| notion_to_md_py-0.1.5.tar.gz | 14.3 kB | Without provenance | Details for notion_to_md_py-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| notion_to_md_py-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for notion_to_md_py-0.1.5-py3-none-any.whl |
Total release size: 24.8 kB
Release files / notion_to_md_py-0.1.5.tar.gz
| Download URL | notion_to_md_py-0.1.5.tar.gz |
|---|---|
| Size | 14.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
327a35bb2a393e458fbf585b5d0d8bb7c2e2834607ad0b86e7f23a5cc0edc807
|
|
BLAKE2b-256 checksum How to use checksums |
ae3bed3750d49dddf15aff5c4f835f9d27741b8f9a8087ad6752e3a87bab0f4d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Release files / notion_to_md_py-0.1.5-py3-none-any.whl
| Download URL | notion_to_md_py-0.1.5-py3-none-any.whl |
|---|---|
| Size | 10.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ef1fffad8f32ce64d75cc064700080f4ff1f2a034cf158f120fe8e59143ab4e3
|
|
BLAKE2b-256 checksum How to use checksums |
9ee9da8e9d7368a72e71985f484b80dc313528df67ef37ebf733c0f33f664a16
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Security for notion-to-md-py 0.1.5
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.