All Projects → asnunes → notion-page-to-html

asnunes / notion-page-to-html

Licence: MIT license
NodeJS tool to convert public Notion pages to HTML from page ID

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to notion-page-to-html

mathconverter
Converts from AsciiMath, LaTeX, MathML to LaTeX, MathML
Stars: ✭ 35 (-67.89%)
Mutual labels:  equation
Mathquill
Easily type math in your webapp
Stars: ✭ 1,968 (+1705.5%)
Mutual labels:  equation
keisan
A Ruby-based expression parser, evaluator, and programming language
Stars: ✭ 48 (-55.96%)
Mutual labels:  equation
stiff3
Adaptive solver for stiff systems of ODEs using semi-implicit Runge-Kutta method of third order
Stars: ✭ 13 (-88.07%)
Mutual labels:  equation
split-ease
The JavaScript Easing function with a beginning, middle and end
Stars: ✭ 55 (-49.54%)
Mutual labels:  equation
tex-equation-to-svg
Convert a TeX or LaTeX string to an SVG.
Stars: ✭ 34 (-68.81%)
Mutual labels:  equation
Equation and Codebox
Microsoft Word VSTO Add-In,可以插入带编号的公式和代码
Stars: ✭ 27 (-75.23%)
Mutual labels:  equation
Fluid Simulation
Self advection, external force and pressure solve to a velocity field represented by a MaC grid.
Stars: ✭ 107 (-1.83%)
Mutual labels:  equation
klatexformula
Generate images from LaTeX equations that you can drag and drop, copy and paste or save to disk.
Stars: ✭ 70 (-35.78%)
Mutual labels:  equation
eqn
A gem to evaluate mathematical equations.
Stars: ✭ 32 (-70.64%)
Mutual labels:  equation
Equation
Solve Math expressions, create equations, define operators and constants
Stars: ✭ 37 (-66.06%)
Mutual labels:  equation
latex in word
LaTeX equation edition in a macro-enabled Word document
Stars: ✭ 29 (-73.39%)
Mutual labels:  equation
chem
Chemical Equation Balancing
Stars: ✭ 17 (-84.4%)
Mutual labels:  equation
Symbolic-Regression
predicting equations from raw data with deep learning
Stars: ✭ 48 (-55.96%)
Mutual labels:  equation

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 the 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 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 dependencies

npm i

Running tests:

npm test

Installing locally in another project:

npm run 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 ;)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].