Notion Down, python tools that convert Notion blog pages into Markdown files, along with integration to build static webpages such as Hexo. Its inspiration and goal is to avoid separation of writing by keep writing drafts or posts within notion.so and then publish them into MD webpages automatically.
- Notion Down
- Examples
- Features
- Hot It Works
- Basic usage
- Advanced usage
- Getting Started
- Prepare
- Run NotionDown
- CI Build Script
- Showcase Jobs
- UnitTest Examples
kaedea.com
hexo.kaedea.com
基于 Notion 的笔记写作和博客分享自动化方案
What can NotionDown do now:
- Notion pages to MarkDown files
(削除) Basic Notion PageBlocks parsing (削除ここまで)(削除) Notion images refer & download (削除ここまで)(削除) Notion nested list blocks (削除ここまで)(削除) Notion obfuscated-links parsing (削除ここまで)(削除) Notion table block (Collection) (削除ここまで)- Notion subpage / alias link parsing
- Advanced Notion PageBlocks support
(削除) Pullquote Blocks (Notion ColumnList) (削除ここまで)- Image source replacing
(削除) Replace notion image url with image file (削除ここまで)- Replace notion image url with other CDN urls
- Notion page embed blocks
- Writing optimized integration
(削除) Noton customShortCodeblocks that control parametered MD files generating (削除ここまで)(削除) Mixed CN-EN text separation format (削除ここまで)(by pangu)(削除) Spelling inspect (削除ここまで)(by pycorrector)
- HEXO Integration
(削除) HEXO page properties config (削除ここまで)(削除) HEXO generate (削除ここまで)- HEXO tags plugin
- PyPI Publish
- WIP
- Notion APIs
(削除) notion-py (3rd party) (削除ここまで), as legacy mechanism, see Support of Legacy APIs (token_v2) part at bottom.(削除) notion-sdk (official) (削除ここまで), current mechanism
NotionDown read Notion pages data using notion-sdk-py, and then write pages into MD files.
notion-down >> Notion APIs (notion-sdk-py) >> Notion pages data >> generating MD files
WebHook >> notion-down >> Notion APIs (notion-sdk-py) >> Notion pages data >> generating MD files >> Copy into Hexo source >> generating webpages >> push to GitHub pages
To get started with NotionDown, you should:
- Prepare your Notion Integration Token.
- Prepare
public notion blog_urlas root post for NotionDown to get the pages you want to handle. - Run
notion-down/main.pywith your configs.
Check here to get notion_token.
(For supported of legacy APIs with token_v2 & notion-py, see branch archive/token-v2-support.)
Duplicate NotionDown Posts Template to your own notion and take it as blog_url (or you can just use your existing blog post url). Note that, for now the root page should be public as well as placed in root path of notion workspace.
Basically just run notion-down/main.py :
# Run with cli cmd PYTHONPATH=./ python main.py \ --blog_url <Notion Post Url> \ --notion_token <notion_token> # or PYTHONPATH=./ python main.py \ --config_file '.config_file.json' # Your can configure notion-down args by cli-args, config_file or SysEnv parameters # Priority: cli args > config_file > SysEnv parameters > NotionDown default
For custom configurations in details, see Custom Configurations.
Also check the following procedures as showcase usages for NotionDown.
See GitHub Actions building scripts at /.github/workflows.
build-readme.yml: GitHub Actions workflow that generating README for this repo.build-hexo.yml: GitHub Actions workflow that generating Hexo posts for https://github.com/kaedea/notion-down-hexo-showcase.pycorrector-test.yml: GitHub Actions workflow that that executing spelling check for the test posts.
Also see building script at /.circleci/config.yaml.
test-build-readme: CircleCI jobs generating README for this repo.test-build-hexo: CircleCI jobs generating Hexo posts for https://github.com/kaedea/notion-down-hexo-showcase.test-run-pycorrector: CircleCI jobs that executing spelling check for the test posts.
See the usage showcase jobs at /jobs, and jobs outputs at /dist.
- README generating
- Notion sample post generating
- HEXO public generating
- Notion image page source replacing (WIP)
See unittest cases at test/.
The lastest APIs of notion-down has been migrated form 3rd-party token_v2 to official integration token. For supported of legacy APIs with token_v2 & notion-py, see branch archive/token-v2-support.
This page is generated by notion-down from notion.so NotionDown-README.