https://github.com/echo724/notion2md
Notion Markdown Exporter with Python Cli
https://github.com/echo724/notion2md
markdown notion notion-markdown
Last synced: 1 day ago
JSON representation
Notion Markdown Exporter with Python Cli
- Host: GitHub
- URL: https://github.com/echo724/notion2md
- Owner: echo724
- License: mit
- Created: 2020-06-29T01:43:38.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2024-01-10T11:15:45.000Z (over 1 year ago)
- Last Synced: 2025-04-07T09:11:14.217Z (9 days ago)
- Topics: markdown, notion, notion-markdown
- Language: Python
- Homepage:
- Size: 6.79 MB
- Stars: 708
- Watchers: 8
- Forks: 58
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-notion - notion2md - Convert your Notion file to markdown - built on-top of notion-py. (APIs)
README

## About Notion2Md
[](https://pepy.tech/project/notion2md)
[](https://badge.fury.io/py/notion2md)
[](https://github.com/echo724/notion2md/actions/workflows/code_quality.yaml)- Notion Markdown Exporter using **official notion api** by [notion-sdk-py](https://github.com/ramnes/notion-sdk-py)
### Notion2Medium
- Check out [Notion2Medium](https://github.com/echo724/notion2medium) that publishes a **Medium** post from **Notion** using Notion2Md.
## API Key(Token)
- Before getting started, create [an integration and find the token](https://www.notion.so/my-integrations). → [Learn more about authorization](https://developers.notion.com/docs/authorization).
- Then save your api key(token) as your os environment variable
- From version 2.9.0, you can use `--token` or `-t` option to set your token key.
```Bash
$ export NOTION_TOKEN="{your integration token key}"
```## Install
```Bash
$ pip install notion2md
```## Usage: Shell Command

- Notion2md requires either `id` or `url` of the Notion page/block.
- **download** option will download files/images in the `path` directory.
- **unzipped** option makes Notion2Md export ***unzipped*** output of Notion block.
```Bash
notion2md --download -n post -p ~/MyBlog/content/posts -u https://notion.so/...
```- This command will generate "**post.zip**" in your '**~/MyBlog/content/posts**' directory.
## Usage: Python
```Python
from notion2md.exporter.block import MarkdownExporter, StringExporter# MarkdownExporter will make markdown file on your output path
MarkdownExporter(block_id='...',output_path='...',download=True).export()# StringExporter will return output as String type
md = StringExporter(block_id='...',output_path='...').export()
```## To-do
- [x] Download file object(image and files)
- [x] Table blocks
- [x] Synced Block
- [ ] Page Exporter
- [ ] Child page
- [ ] Column List and Column Blocks## Contribution
Please read [Contribution Guide](CONTRIBUTION.md)
## Donation
If you think **Notion2Md** is helpful to you, you can support me here:
## License
[MIT](https://choosealicense.com/licenses/mit/)