Skip to main content

A renderer and uploader for Markdown files to notion

Project description

twitter twitter

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 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 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


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.3.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

md2notion-0.0.3-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file md2notion-0.0.3.tar.gz.

File metadata

  • Download URL: md2notion-0.0.3.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

Hashes for md2notion-0.0.3.tar.gz
Algorithm Hash digest
SHA256 e4a03afc66c3b28415ef7ad9954da0d2df0611696c9576ad95f5f74294cffb34
MD5 55eb98696e9caa950166b59c2a20b40a
BLAKE2b-256 3b60dbfa6ceb072182fbe6d748635d3d0354f5b454e80985ffa2f865d0faeef7

See more details on using hashes here.

File details

Details for the file md2notion-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: md2notion-0.0.3-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

Hashes for md2notion-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6ee40d46fbbc3dbb583b378b4f70ebf91c1e96c7352148f6433a89565aa865f7
MD5 d68dd4b222a4ddd1b7a1c60a7131f37e
BLAKE2b-256 f22fd1a03580b7b67e6eedf136c0a60be2f4cbf9e5c1a7630a770fe93344b049

See more details on using hashes here.

Supported by

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