Script to fetch pages from Notion database and convert it to Markdown using official Notion API.
script.py --content CONTENT_FOLDER --static STATIC_FOLDER --url STATIC_URL --db NOTION_DB_ID --key NOTION_API_KEY [--hugo]CONTENT_FOLDER path where the pages will be saved
STATIC_FOLDER path where the static files will be saved
STATIC_URL URL from which the static files will be accessible from the Markdown file
NOTION_DB_ID Notion database id where the pages to fetch are located
NOTION_API_KEY Notion API key
To get NOTION_DB_ID and NOTION_API_KEY you can refer to steps 1 to 3 of this article.
This script can be used for Hugo, for that use this database template and add --hugo flag.
It will add the front matter to each page and fetch only published ones.
- heading
- divider
- image
- code block
- inline annotation (link, code, bold, italic, strikethrough, underline, highlight)
- bulleted list
- numbered list
- to do list
- quote
- block children
- convert page properties to front matter
- only fetch published pages