Giter Club home page Giter Club logo

notion-graph-view's Introduction

Notion Graph View

github github github

Export Notion pages to a Roam-Research like graph view.

Buy Me A Coffee

๐Ÿ“œ Usage

Environment

  • Python >= 3.9

Installing

pip install notion-graph

Notion API Setup

  1. Create a notion internal integration and generate an Internal Integration Token.

    ๐Ÿ‘‰ Learn more about authorization

  2. Open one notion page on the browser, select "Add connections" and add your integration account.

  3. Find your base Page ID from the browser URL, for example:

if page url is: https://www.notion.so/yourName/PageTitle-8a4b5ff100d648fb8d39d4bfa756ff3f, 8a4b5ff100da48fb8d39d4bfa756ff3f is the Page ID

Quickly Running

python -m notion_graph -p <Page ID> -t <Integration Token> -o <file path to export>

For instance,

python -m notion_graph -p 856391c93ae64bd1b7ebf699ca0cd861 -t secret_b8p7uLp3j3n95IDgofC9GviXP111Skx6NOt2d20U8e -o ./graph_out.html

graph_out.html would be generated at your specific path.

Importing as a Python Library

You can also import notion_graph as a library.

For instance, draw your diagram in Jupyter Notebook.

import notion_graph as ng

my_ng = ng.NotionGraph(bearer_token="secret_b8p7uLp3j3n95IDgofC9GviXP111Skx6NOt2d20U8e")
network = my_ng.parse(page_id="856391c93ae64bd1b7ebf699ca0cd861")
# `network` is a `pyvis.network.Network` object, see more attributes: https://pyvis.readthedocs.io/en/latest/documentation.html
network.repulsion(node_distance=200, spring_length=200)
# this line is for jupeter notebook only
network.prep_notebook()

network.show("graph.html")

Testing Environment

The testing page is Notion-graph-view-demo. You can duplicate the page to your Notion account and run the project to test if everything goes well.

Development Guide

This project's dependencies are managed by PDM.

brew install pdm
pdm install

Running the project by:

pdm run start -p <page_id> -t <notion_token> -o ./graph_out.html

๐Ÿ”— Supported Links

database page
paragraph โœ”๏ธ โœ”๏ธ
bulleted_list_item โœ”๏ธ โœ”๏ธ
numbered_list_item โœ”๏ธ โœ”๏ธ
to_do โœ”๏ธ โœ”๏ธ
toggle โœ”๏ธ โœ”๏ธ
child_page โœ”๏ธ โœ”๏ธ
child_database โœ”๏ธ โœ”๏ธ
embed
callout โœ”๏ธ โœ”๏ธ
quote โœ”๏ธ โœ”๏ธ
heading_1 โœ”๏ธ โœ”๏ธ
heading_2 โœ”๏ธ โœ”๏ธ
heading_3 โœ”๏ธ โœ”๏ธ
column โœ”๏ธ โœ”๏ธ
column_list โœ”๏ธ โœ”๏ธ
synced_block
link_to_page โœ”๏ธ โœ”๏ธ
table โœ”๏ธ โœ”๏ธ
table_row โœ”๏ธ โœ”๏ธ

notion-graph-view's People

Contributors

stevedsun avatar 0armaan025 avatar bobronium avatar dylfaen avatar skyran1278 avatar prajjwalyd avatar rayremnant avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.