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
md2notion-0.0.1.tar.gz
(4.8 kB
view hashes)
Built Distribution
Close
Hashes for md2notion-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c8ae2add730bd7b945dddfe8b07d5d8da745159186d2a487afe0c0004fdc684 |
|
MD5 | 7468ba8dbbe5f245cc0e94b4eb5fbce3 |
|
BLAKE2b-256 | c4e50340de12d18d5c843fca4797c857ef48ec0a7a65032a59e3c40417d0557d |