npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

notion-page-to-html-cover-page-fix

v1.1.3

Published

It converts public notion pages to html from url

Downloads

6

Readme

Cover image

Notion Page To HTML

NodeJS tool to convert public notion pages to HTML.

Also available as public API:

https://notion-page-to-html-api.vercel.app/

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.

Why notion-page-to-html?

It's perfect as content manager system

  • This tool can get any public page from Notion and convert it to html. This is perfect for the ones who want to use Notion as CMS. Once it gets page content from Notion, it becomes completely independent (images are converted to base64 so you do not have to call Notion again to get content). You can convert a page and then make it private again.

It's fully customizable

  • You can choose how you want to get page content. Do you want title, cover, and icon in html body? You can do that! Do you want they apart of html so you can choose where place it? You have it. Do want html without style? Without Equation and Code Highlighting scripts? Do you want body content only? You have those options too.

Basic Usage

Install it in a NodeJS project using npm

npm install notion-page-to-html

Then, just import it and paste a public Notion page url

const NotionPageToHtml = require('notion-page-to-html');

// using then
NotionPageToHtml.convert("https://www.notion.so/asnunes/Simple-Page-Text-4d64bbc0634d4758befa85c5a3a6c22f").then((page) => console.log(page));

// using async/await
async function getPage() {
  const { title, icon, cover, html } = await NotionPageToHtml.convert("https://www.notion.so/asnunes/Simple-Page-Text-4d64bbc0634d4758befa85c5a3a6c22f");
  console.log(title, icon, cover, html);
}

getPage();

cover is a base64 string from original page cover image. icon can be an emoji or base64 image based on original page icon. html is a full html document by default. It has style, body, MathJax and PrismJS CDN scripts by default. You can pass some options to handle html content.

NotionPageToHtml.convert(
  'https://www.notion.so/asnunes/Simple-Page-Text-4d64bbc0634d4758befa85c5a3a6c22f',
  options,
);

options is an object with the following keys

| Key | Default value | If true | | ----------------------- | ------------- | ------------------------------------------------------ | | excludeCSS | false | returns html without style tag | | excludeMetadata | false | returns html without metatags | | excludeScripts | false | returns html without script tags | | excludeHeaderFromBody | false | returns html without title, cover and icon inside body | | excludeTitleFromHead | false | returns html without title tag in head | | bodyContentOnly | false | returns html body tag content only |


Development and testing

  1. Clone this application

  2. Make sure you have node v14 or higher and then install all of the dependencies

npm i

Running tests:

npm test

Installing locally in another project:

npm build
npm pack

Inside your project:

npm i /path/to/tar/gz

Docker approach for testing

  1. Make sure you have Docker and Docker Compose installed and then run:
make test

Contributing

We love your feedback! Feel free to:

  • Report a bug
  • Discuss the current state of the code
  • Submit a fix
  • Propose new features
  • Become a maintainer

Just create a Github issue or a PR ;)