Skip to content

A tool for fetching Notion page trees, written in Clojure.

License

Notifications You must be signed in to change notification settings

Flexiana/notion-to-md

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub License

Clojars Project

Notion to Markdown: a tool for fetching Notion page trees, written in Clojure. Can be used to sync Readme files.

Concepts

Notion API requires a page-id and a notion-secret to be able to access a page’s content:

Usage

Lein

Add this to your dependencies:

  [com.flexiana/notion-to-md "0.1.11"]

Alias it with the following:

  :profiles {:local
               {:dependencies
                [[com.flexiana/notion-to-md "0.1.11"]]}}
    :aliases {"notion-to-md"     
              ["with-profile" 
               "local" 
               "run" 
               "-m" 
               "notion-to-md.core"]}

Invoke it with lein notion-to-md.

Pass arguments either by:

Outputs

  • The main notion page (referenced by the NOTION_PAGE_ID environment variable) is going to generate the README.md file.

  • The sub pages are going to be created inside the docs/readme/ folder.

Recommendations

  1. Avoid using "link_to_page". Use “sub pages” instead. Or use “mention” if you want to make a link. Reason: A "link_to_page" is going to be inlined for technical reasons (the link's title is not easy to get). So, just use “sub pages” or “mentions” for the README files.

Unsupported Notion types

notion-to-md does not support the types below:

  1. "table_of_contents" doesn’t provide data.

  2. "table" provides "unsupported" for each row.

  3. "child_database" is complex and probably is not going to be used in a README.md so it's not supported by notion-to-md.

  4. "link_preview"

Allowing access to Notion API

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.

  1. Go to the page you want to fetch.

  2. Click “Share” at the top-right corner.

  3. Click “Invite”.

  4. Select the Integration user you have added prior to this.

Notes

The tool automatically fetches all sub pages as well.

References

Authors

Brought to you with ❤️ by Flexiana.

License

Copyright 2022 Flexiana.

Written and distributed under Apache License 2.0.

How to guides [internal]

Update Readme on GitHub