A renderer and uploader for Markdown files to notion
Project description
Markdown to Notion-py
A renderer and uploader for Markdown files to Notion.so using notion-py
Why use this package?
As of writing, Notion's Markdown importer has some problems:
- Code fences don't seem to retain their original language or format properly
- Inline HTML is removed, including iframes
- Markdown frontmatter is removed
- Local image references show up as blank images
- Image alts are loaded as
TextBlock
s instead of captions - Among others...
This package aims to make bulk import much easier by solving the problems above. If you dislike the way this package implements a specific Markdown to Notion conversion or you need extra functionality (like uploading your images to Cloud hosting), you can always subclass NotionPyRenderer
(a BaseRenderer
for mistletoe
) and change it or hook its behavior.
Usage with Python 3.6+
-
pip install md2notion
-
In your Python file:
from notion.client import NotionClient
from md2notion.convert import convert
# Follow the instructions at https://github.com/jamalex/notion-py#quickstart to setup Notion.py
client = NotionClient(token_v2="<token_v2>")
page = client.get_block("https://www.notion.so/myorg/Test-c0d20a71c0944985ae96e661ccc99821")
with open("TestMarkdown.md", "r") as f:
convert(f.read(), page)
Contributing
See CONTRIBUTING.md
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
File details
Details for the file md2notion-0.0.2.tar.gz
.
File metadata
- Download URL: md2notion-0.0.2.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eab442a374b9790a6305f772c863987296967c61c827cbcc757f34143dd7c230 |
|
MD5 | ec0367fcbe650e6447a56bff0923962d |
|
BLAKE2b-256 | ada0111b9f935f680a22be4d418db4998b27ccf5e82ee1f195f86a5a10715a43 |
File details
Details for the file md2notion-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: md2notion-0.0.2-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d110c3edb1bcf2aa33828e3bbc3adb61541fcd129d65149696bb744bb863e860 |
|
MD5 | f4d0441583127af48b0f4d73516f220e |
|
BLAKE2b-256 | aca9fa1010609d9c470dff9a36fd41e1a2b425390cd2bec72eec8fad78dc5e9d |