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
- Set up a virtual environment
python3 -m pip install virtualenv # only do this the first time
- Create a virtual environment
python3 -m virtualenv venv
- Activate the virtual environment
source venv/bin/activate
- Install the dependencies
python3 -m pip install -r requirements.in
- 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
bumpversion patch # Look-up bumpversion
rm -rf dist/
python3 setup.py sdist bdist_wheel
python3 -m twine upload dist/*
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file git_notion_pretty-1.0.0.tar.gz.
File metadata
- Download URL: git_notion_pretty-1.0.0.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25ae8c213de68b421d18226c76f4b110974b73809746242f51ff0d8c2e56bbf6
|
|
| MD5 |
a22f81c5220c40b4d9ef0395fb07ee0d
|
|
| BLAKE2b-256 |
e162e603739d009a4d6eccbf92c1cc4d7d18caa7f731390786688f7419d70b30
|
File details
Details for the file git_notion_pretty-1.0.0-py2.py3-none-any.whl.
File metadata
- Download URL: git_notion_pretty-1.0.0-py2.py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
364c15df68d2e797cbe6dba055a95cf326d461fc4d50a1ccfe8726830f7fc20d
|
|
| MD5 |
8c4c68eb88b39b0cd5419635d9f8a648
|
|
| BLAKE2b-256 |
d2e8667a281683b7378962e75264680ec942f44c7528dccdaafb4ed87ff6c2ce
|