Notion Import Markdown



Every smartphone comes with a native note-taking app, but there are several other apps out there that can offer you extended functionalities. If you are an iOS user, then the App Store offers wide. Markdown is a popular rich-text format that is supported as an export format by a broad range of notes, documents, and wiki apps. To import markdown files: Select Import Notes from the user menu in the bottom-left corner of Notejoy Select the target notebook for the import.

Latest version

Released:

Unofficial Python API client for Notion.so

Project description

Unofficial Python 3 client for Notion.so API v3.

  • Object-oriented interface (mapping database tables to Python classes/attributes)
  • Automatic conversion between internal Notion formats and appropriate Python objects
  • Local cache of data in a unified data store (Note: disk cache now disabled by default; to enable, add enable_caching=True when initializing NotionClient)
  • Real-time reactive two-way data binding (changing Python object -> live updating of Notion UI, and vice-versa) (Note: Notion->Python automatic updating is currently broken and hence disabled by default; call my_block.refresh() to update, in the meantime, while monitoring is being fixed)
  • Callback system for responding to changes in Notion (e.g. for triggering actions, updating another API, etc)

Quickstart

Note: the latest version of notion-py requires Python 3.5 or greater.

pip install notion

Concepts and notes

  • We map tables in the Notion database into Python classes (subclassing Record), with each instance of a class representing a particular record. Some fields from the records (like title in the example above) have been mapped to model properties, allowing for easy, instantaneous read/write of the record. Other fields can be read with the get method, and written with the set method, but then you'll need to make sure to match the internal structures exactly.
  • The tables we currently support are block (via Block class and its subclasses, corresponding to different type of blocks), space (via Space class), collection (via Collection class), collection_view (via CollectionView and subclasses), and notion_user (via User class).
  • Data for all tables are stored in a central RecordStore, with the Record instances not storing state internally, but always referring to the data in the central RecordStore. Many API operations return updating versions of a large number of associated records, which we use to update the store, so the data in Record instances may sometimes update without being explicitly requested. You can also call the refresh method on a Record to trigger an update, or pass force_update to methods like get.
  • The API doesn't have strong validation of most data, so be careful to maintain the structures Notion is expecting. You can view the full internal structure of a record by calling myrecord.get() with no arguments.
  • When you call client.get_block, you can pass in either an ID, or the URL of a page. Note that pages themselves are just blocks, as are all the chunks of content on the page. You can get the URL for a block within a page by clicking 'Copy Link' in the context menu for the block, and pass that URL into get_block as well.

Updating records

We keep a local cache of all data that passes through. When you reference an attribute on a Record, we first look to that cache to retrieve the value. If it doesn't find it, it retrieves it from the server. You can also manually refresh the data for a Record by calling the refresh method on it. By default (unless we instantiate NotionClient with monitor=False), we also subscribe to long-polling updates for any instantiated Record, so the local cache data for these Records should be automatically live-updated shortly after any data changes on the server. The long-polling happens in a background daemon thread.

Example: Traversing the block tree

Example: Adding a new node

Example: Deleting nodes

Example: Create an embedded content type (iframe, video, etc)

Notion Import Markdown Excel

Example: Create a new embedded collection view block

Example: Moving blocks around

Example: Subscribing to updates

(Note: Notion->Python automatic updating is currently broken and hence disabled by default; call my_block.refresh() to update, in the meantime, while monitoring is being fixed)

We can 'watch' a Record so that we get a callback whenever it changes. Combined with the live-updating of records based on long-polling, this allows for a 'reactive' design, where actions in our local application can be triggered in response to interactions with the Notion interface.

Example: Working with databases, aka 'collections' (tables, boards, etc)

Here's how things fit together:

  • Main container block: CollectionViewBlock (inline) / CollectionViewPageBlock (full-page)
    • Collection (holds the schema, and is parent to the database rows themselves)
      • CollectionRowBlock
      • CollectionRowBlock
      • ... (more database records)
    • CollectionView (holds filters/sort/etc about each specific view)

Note: For convenience, we automatically map the database 'columns' (aka properties), based on the schema defined in the Collection, into getter/setter attributes on the CollectionRowBlock instances. The attribute name is a 'slugified' version of the name of the column. So if you have a column named 'Estimated value', you can read and write it via myrowblock.estimated_value. Some basic validation may be conducted, and it will be converted into the appropriate internal format. For columns of type 'Person', we expect a User instance, or a list of them, and for a 'Relation' we expect a singular/list of instances of a subclass of Block.

Note: You can combine filter, aggregate, and sort. See more examples of queries by setting up complex views in Notion, and then inspecting the full query: cv.get('query2').

You can also see more examples in action in the smoke test runner. Run it using:

Example: Lock/Unlock A Page

Example: Set the current user for multi-account user

If you'd like to support notion-py development, please consider donating to my open-source nonprofit, Learning Equality, since when I'm not working on notion-py, it probably means I'm heads-down fundraising for our global education work (bringing resources like Khan Academy to communities with no Internet). COVID has further amplified needs, with over a billion kids stuck at home, and over half of them without the connectivity they need for distance learning. You can now also support our work via GitHub Sponsors!

  • md2notion: import Markdown files to Notion
  • notion-export-ics: Export Notion Databases to ICS calendar files
  • notion-tqdm: Progress Bar displayed in Notion like tqdm
  • Cloning pages hierarchically
  • Debounce cache-saving?
  • Support inline 'user' and 'page' links, and reminders, in markdown conversion
  • Utilities to support updating/creating collection schemas
  • Utilities to support updating/creating collection_view queries
  • Support for easily managing page permissions
  • Websocket support for live block cache updating
  • 'Render full page to markdown' mode
  • 'Import page from html' mode

Release historyRelease notifications | RSS feed

0.0.28

0.0.27

0.0.25

0.0.24

Import

0.0.23

0.0.22

0.0.21

0.0.20

0.0.19

0.0.18

0.0.17

0.0.16

0.0.15

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for notion, version 0.0.28
Filename, sizeFile typePython versionUpload dateHashes
Filename, size notion-0.0.28-py3-none-any.whl (43.6 kB) File type Wheel Python version py3 Upload dateHashes
Filename, size notion-0.0.28.tar.gz (44.8 kB) File type Source Python version None Upload dateHashes
Close

Hashes for notion-0.0.28-py3-none-any.whl

Hashes for notion-0.0.28-py3-none-any.whl
AlgorithmHash digest
SHA256cc380ea2ffe70ee8d5f19244df910cc79ea56a577ca569553d30f8798f0b5b61
MD507efa97e236644a08957aecbf2508c7a
BLAKE2-2565372df35288d7bcdf69961bdf3aa33b02d9cd4b2a9a650bee36dd4aa4163657b

Notion Import Markdown

Close

Hashes for notion-0.0.28.tar.gz

Hashes for notion-0.0.28.tar.gz
AlgorithmHash digest
SHA256a6c511e1055bb69f05d75220f3f6a5de377a52d42ae38186c3138557c6b4942a
MD58ffe0b4c1f94dca794d0530c26e7d8d0
BLAKE2-25668d5f47c532d8da331b78fd3f890e2377442d414febc4156f27457a9b335074b

Notion Export Markdown

How To Add Books From Web Clipper

Step 1: Save readable web-page with Webclipper into desired database

Make sure the webpage only contains the text of the digital book.

Step 2: Toggle Chapters (trigger: /toggle)

The digital book should automatically appear inside the page if the webpage allows. If it does not appear after a few minutes, try navigating outside the page and back in. If text still does not appear, follow directions below.

How To Add Large Digital Books With Import

Google Docs Import Markdown

Compatibility: txt files, epubs, markdown, etc.
*Note: large digital books like textbooks will not transfer with webclipper. An error message will appear if this is the case. Use import instead as follows:

Step 1: Navigate To Import

Step 3: Create Table Of Contents (trigger: /toc)

Notion import markdown

Proceed to drag table of contents into a toggle for a more compact view.