Giter VIP home page Giter VIP logo

kaedea / notion-down Goto Github PK

View Code? Open in Web Editor NEW
119.0 2.0 8.0 469 KB

Notion >> Markdown. Python utility that converts Notion pages into MD files, along with intergation to build static webpages such as Hexo | 自动从 Notion 笔记生成 MD 文件,并部署到 Hexo 静态博客 | Notion Pages より Markdown Files をコンバートする、更に Hexo Webpages までの自動化も可能

Home Page: https://kaedea.notion.site/NotionDown-README-d3463f3d398743879d663caf87efa029

Python 100.00%
notion notion-blog markdown hexo notion-markdown devops

notion-down's Introduction

Notion Down

🇨🇳 🇯🇵

BANNER-02

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.

Examples

kaedea.com
hexo.kaedea.com
基于 Notion 的笔记写作和博客分享自动化方案

Features

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 custom ShortCode blocks 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
  • Notion APIs
    • notion-py (3rd party)
    • notion-sdk (official)

Hot It Works

NotionDown Workflows

NotionDown read Notion pages data using notion-py, and then write pages into MD files.

Basic usage

notion-down >> Notion APIs (notion-py) >> Notion pages data >> generating MD files

Advanced usage

WebHook >> notion-down >> Notion APIs (notion-py) >> Notion pages data >> generating MD files >> Copy into Hexo source >> generating webpages >> push to GitHub pages

Getting Started

Prepare

To get started with NotionDown, you should:

  1. Prepare your Notion username(email) and password, or directly use notion_token_v2.
  2. Prepare public notion blog_url as root post for NotionDown to get the pages you want to handle.
  3. Run notion-down/main.py with your configs.

Check here to get notion_token_v2.

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.

Run NotionDown

Basically just run notion-down/main.py :

# Run with cli cmd
PYTHONPATH=./ python main.py \
    --blog_url <Notion Post Url> \
    --token_v2 <token_v2>
    --username <username>  # Only when token_v2 is not presented
    --password <password>  # Only when token_v2 is not presented

# 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.

CI Build Script

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.

Showcase Jobs

See the usage showcase jobs at /jobs, and jobs outputs at /dist.

UnitTest Examples

See unittest cases at test/.


This page is generated by notion-down from notion.so NotionDown-README.

notion-down's People

Contributors

kaedea avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

notion-down's Issues

main.py 运行失败

Linux 版本: Debian 10
Python 版本: 2.7.16
NotionDown 版本: 最新 master 分支

运行命令

python main.py \
--blog_url https://like-plum-3be.notion.site/NotionDown-Posts-Template-2af05230e0c14c8094d7665e4b954ad5 \
--token_v2 xxxxxxxxxxx

运行结果

Traceback (most recent call last):
  File "main.py", line 2, in <module>
    from notion_reader import NotionReader
  File "/root/notion-down/notion_reader.py", line 21
    def get_client() -> NotionClient:
                     ^
SyntaxError: invalid syntax

不清楚是哪里出了问题

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.