Git Product home page Git Product logo

notion-renderer's Introduction

notion-renderer

Quality Gate Status Coverage Security Rating Known Vulnerabilities

what ?

Simple and naive Notion react renderer, not as advanced as react-notion-x

npm install notion-renderer react --save
import { NotionContentRenderer } from "notion-renderer";
import fetch from "cross-fetch";

const contentId = `<NOTION_CONTENT_ID>`;
const data = await fetch(`https://www.notion.so/api/v3/loadPageChunk`, {
  method: "POST",
  headers: {
    cookie: `token_v2=${process.env.NOTION_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    page: {
      id: contentId,
    },
    chunkNumber: 0,
    cursor: { stack: [] },
    limit: 100,
    verticalColumns: false,
  }),
}).then((response) => response.json());

const { recordMap } = data;
const imageSource = (url) => url;
<NotionContentRenderer
  recordMap={recordMap}
  id={contentId}
  imageSource={imageSource}
/>;

why ?

  • I was writing some notes and reflections on publishing based on my decade worth of experience in the field
  • I stumbled upon Notion and thought I'd make friends with its API
  • I figured it would make a great NodeJS and react frontend refresher ... since I trapped myself in Java/Maven backend world for way too long
  • so I ended up re-inventing one or two wheels for sake of unlearning old habits and picking up new ones.

how ?

git clone [email protected]:viqueen/notion-renderer.git
cd notion-renderer
nvm use

npm ci
npm run build
npm test

notion-renderer's People

Contributors

viqueen avatar

Stargazers

Priya Srivastava avatar

Watchers

 avatar  avatar

Forkers

criestlav

notion-renderer's Issues

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.