Notion to Markdown: a tool for fetching Notion page trees, written in Clojure. Can be used to sync Readme files.
Notion API requires a page-id
and a notion-secret
to be able to access a page’s content:
If the url is https://www.notion.so/Testnet-8ddeb7e276c34685b460c5380f592f9d
, then page-id
is 8ddeb7e276c34685b460c5380f592f9d
.
notion-secret
is obtained in Notion’s workspace configuration. Go to My Integrations & add a New Integration. After you follow the steps there, you’ll end up with a secret string that looks like this: secret_j2oz4j12ddjoalmdp91phesdahjlcsdwq0u11ay3Df8
.
Add this to your dependencies:
[com.flexiana/notion-to-md "0.1.8"]
Alias it with the following:
:profiles {:local
{:dependencies
[[com.flexiana/notion-to-md "0.1.8"]]}}
:aliases {"notion-to-md"
["with-profile"
"local"
"run"
"-m"
"notion-to-md.core"]}
Invoke it with lein notion-to-md
.
Pass arguments either by:
NOTION_PAGE_ID
and NOTION_API_SECRET
environment variables.
export NOTION_PAGE_ID="<page-id>"
export NOTION_API_SECRET="<notion-secret>"
lein notion-to-md
This is the way to go when integrating GitHub actions. See https://docs.github.com/en/actions/learn-github-actions/environment-variables
Or as parameters:
lein notion-to-md <notion-secret> <page-id>
To interact with the API, we have to give the integration user access to page(s) we want to fetch. To achieve this, follow the steps below.
Go to the page you want to fetch.
Click “Share” at the top-right corner.
Click “Invite”.
Select the Integration user you have added prior to this.
The tool automatically fetches all sub pages as well.
Markdown reference: https://www.markdownguide.org/basic-syntax/
API reference: https://developers.notion.com/reference/block
Brought to you with ❤️ by Flexiana.
Copyright 2022 Flexiana.
Written and distributed under Apache License 2.0.
Can you improve this documentation? These fine people already did:
Daniel Vieira, github-actions[bot], danielhvs, sandudorogan & Daniel Habib Vieira da SilvaEdit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close