Giter VIP home page Giter VIP logo

notion-page-to-html-api's Introduction

Cover image

notion-page-to-html-api

Vercel API wrapper to notion-page-to-html library. It converts public notion pages to html.

Supported features

Most of native Notion blocks are currently supported:

  • Headings
  • Text With Decorations
  • Quote
  • Image
  • YouTube Videos
  • Code
  • Math Equations
  • To-do
  • Checkbox
  • Bulleted Lists
  • Numbered Lists
  • Toggle Lists
  • Divider
  • Callout
  • Nested blocks

Embeds and tables are not supported yet.

Basic Usage

GET /html

Returns full Notion page as html.

It accepts one single query param: id. It's the Notion Page uuid at the end of page's link like example bellow

https://www.notion.so/asnunes/Simple-Page-Text-2-4d64bbc0634d4758befa85c5a3a6c22f

Page must be public when request is sent. It can be private afterward. All images dependencies are converted to base64 to prevent further Notion API calls.

API call example:

https://notion-page-to-html-api.vercel.app/html?id=4d64bbc0634d4758befa85c5a3a6c22f

GET /cover

Returns Notion page cover image if it exists. If no cover is found, it returns 404.

It accepts one single query param: id. It's exactly like /html route.

API call example:

https://notion-page-to-html-api.vercel.app/cover?id=4d64bbc0634d4758befa85c5a3a6c22f

GET /icon

Returns Notion page icon if it exists. It can be an image (custom icon) or plain/text (emoji). If no icon is found, it returns 404.

It accepts one single query param: id. It's exactly like /html route.

API call example:

https://notion-page-to-html-api.vercel.app/icon?id=4d64bbc0634d4758befa85c5a3a6c22f

GET /title

Returns Notion page title as plain text.

It accepts one single query param: id. It's exactly like /html route.

API call example:

https://notion-page-to-html-api.vercel.app/title?id=4d64bbc0634d4758befa85c5a3a6c22f

This project was deployed on Vercel. Feel free to host it by yourself if it pleases you.

notion-page-to-html-api's People

Contributors

asnunes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

notion-page-to-html-api's Issues

Invalid Page URL error with functioning link

When I upload a public link such as this one:
https://picayune-slice-2e6.notion.site/Alex-DC-s-Design-Portfolio-c57f657f2ff043b88d43ae227f45a16f

I get the following error
InvalidPageUrlError: Url "https://picayune-slice-2e6.notion.site/Alex-DC-s-Design-Portfolio-c57f657f2ff043b88d43ae227f45a16f" is not a valid notion page.

I don't know why my Notion URL looks like that but it does and I am not sure if there is any way to make a URL like that work without editing the URL before pasting it in.

No Options?

Your source project notion-page-to-html has options to filter output HTML. But we cannot do the same with vercel API. Do you plan to add?

Issues with images

It seems that the server fails A server error has occurred FUNCTION_INVOCATION_FAILED when:

  1. There are multiple images on the notion page or
  2. The images have a ratio of height/width > 1

vercel dev returns 502: BAD_GATEWAY

image

Commandline Output:

Vercel CLI 20.1.2 dev (beta) โ€” https://vercel.com/feedback
> Ready! Available at http://localhost:3000
Error! Failed to complete request to /html?id=4d64bbc0634d4758befa85c5a3a6c22f: Error: connect ECONNREFUSED ::1:50124
Error! Failed to complete request to /html?id=4d64bbc0634d4758befa85c5a3a6c22f: Error: connect ECONNREFUSED ::1:50170
Error! Failed to complete request to /api/html?id=4d64bbc0634d4758befa85c5a3a6c22f: Error: connect ECONNREFUSED ::1:50174
Error! Failed to complete request to /html?id=4d64bbc0634d4758befa85c5a3a6c22f: Error: connect ECONNREFUSED ::1:50185

Someone now what can be wrong?

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.