A renderer and uploader for Markdown files to notion
Markdown to 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
TextBlocks 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
mistletoe) and change it or hook its behavior.
- Currently does not support tables/
Usage with Python 3.6+
pip install md2notion
From the command link you can run
python -m md2notion.convert [token_v2] [page-url] [...markdown_path_globs]
OR 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, page)
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size md2notion-0.0.4-py3-none-any.whl (6.7 kB)||File type Wheel||Python version py3||Upload date||Hashes View hashes|
|Filename, size md2notion-0.0.4.tar.gz (5.3 kB)||File type Source||Python version None||Upload date||Hashes View hashes|
Hashes for md2notion-0.0.4-py3-none-any.whl