Skip to main content

Syncs GitHub Markdown files to Notion

Project description

Git Notion

Syncs Github markdown files in your repository to Notion.

This utility is described in the following blog post.

See example Notion page.

Installation

pip install git-notion

or for local installation:

git clone https://github.com/Harbor-Systems/git-notion.git
cd git-notion-pretty
pip install -e .

Configuring

NOTION_TOKEN_V2 - Can be found in your browser cookies for Notion's website.
NOTION_ROOT_PAGE - URL for notion page. Repo docs will be a new page under this page.
NOTION_EXCLUDE_REGEX - Regex for paths to ignore.
NOTION_INCLUDE_REGEX - Regex for paths to include.
NOTION_CONFIG_PATH - Path to the setup.cfg file.

These environment variables can be set.

export NOTION_TOKEN_V2=<YOUR_TOKEN>
export NOTION_ROOT_PAGE="https://www.notion.so/..."  # Can be in setup.cfg as well
export NOTION_IGNORE_REGEX="(?i)(vendor\/.*\.md|deleteme\.md)" # Can be in setup.cfg as well
export NOTION_INCLUDE_REGEX="(?i)(docs\/.*\.md|readme\.md)" # Can be in setup.cfg as well
export NOTION_CONFIG_PATH="docs/"

These parameters can be set in the setup.cfg for the repo.

[git-notion]
ignore_regex = models/.*
include_regex = docs/.*
notion_root_page = https://www.notion.so/...

Running Locally

  1. Set up a virtual environment
python3 -m pip install virtualenv # only do this the first time
  1. Create a virtual environment
python3 -m virtualenv venv
  1. Activate the virtual environment
source venv/bin/activate
  1. Install the dependencies
python3 -m pip install -r requirements.in
  1. Set any environment variables and run the command
export NOTION_TOKEN_V2=<...>
export NOTION_ROOT_PAGE="https://www.notion.so/..."
python3 git-notion-pretty/cli.py [options]

Usage

# To upload your current directory
git-notion-pretty

# To upload to a different directory name
git-notion-pretty --dir-name="Application Docs"

# To use a flat structure instead of the nested structure
git-notion-pretty --page-structure=flat

# To use the file name instead searching for and using the H1 header on the first line
git-notion-pretty --use-file-name

Pushing to PYPI

python3 -m bumpversion patch   # Look-up bumpversion
rm -rf dist/
python3 setup.py sdist bdist_wheel
python3 -m twine upload dist/*

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

git_notion_pretty-1.0.1.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

git_notion_pretty-1.0.1-py2.py3-none-any.whl (6.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file git_notion_pretty-1.0.1.tar.gz.

File metadata

  • Download URL: git_notion_pretty-1.0.1.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for git_notion_pretty-1.0.1.tar.gz
Algorithm Hash digest
SHA256 2b77ec36b40f725e8eed14f449b8cec9948ef0224fd5caa59de012817c9fa689
MD5 99c56c1cd8d018cd99aa18dc333ebc8e
BLAKE2b-256 2683ff9c099c66a7fba2586516cc2f7308da119c864c0a3c0f3baf27bd2a3ebb

See more details on using hashes here.

File details

Details for the file git_notion_pretty-1.0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for git_notion_pretty-1.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4fa922b870ad4d091fa3a7c414e01e6a0178ae2f4a14f1d231ebae53190fdeb8
MD5 9241e83f44260f94932c973132dd19fc
BLAKE2b-256 ee763d3a9712513163f936ab6122f98ab5e14de42873c84420b409811dc4c7c6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page