Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

html-to-notion-blocks

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-to-notion-blocks

Transform HTML to Notion blocks

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Note This repository is automatically generated from the main parser monorepo. Please submit any issues or pull requests there.

html-to-notion-blocks

npm version npm downloads

Transform HTML to Notion blocks

Contents

What is this?

A small library that transforms HTML to Notion blocks. It is based on rehype-to-notion.

When should I use this?

You want a simple way to convert HTML to Notion blocks. If you want to control the conversion process, you should use rehype-to-notion instead.

Install

This package is ESM only. In Node.js (version 12.20+, 14.14+, 16.0+, 18.0+), install as

pnpm add html-to-notion-blocks
# or with yarn
# yarn add html-to-notion-blocks
# or with npm
# npm install html-to-notion-blocks

Use

import { htmlToNotion } from 'html-to-notion-blocks'

const html = '<p>Hello world!</p>'

const notionBlocks = htmlToNotion(html)

console.log(notionBlocks)
// [
//   {
//     object: 'block',
//     type: 'paragraph',
//     paragraph: {
//       text: [
//         {
//           type: 'text',
//           text: {
//             content: 'Hello world!',
//             link: null
//           },
//           annotations: {
//             bold: false,
//             italic: false,
//             strikethrough: false,
//             underline: false,
//             code: false,
//             color: 'default'
//           },
//           plain_text: 'Hello world!',
//           href: null
//         }
//       ]
//     }
//   }
// ]

API


htmlToNotion()

Signature
htmlToNotion(html: string, options?: Options): BlockObjectRequest[];
Parameters
NameType
htmlstring
options?Options
Returns

BlockObjectRequest[]

Defined in: lib/html-to-notion-blocks.ts:5

Security

Use of html-to-notion-blocks can open you up to a [cross-site scripting (XSS)][xss] attack. If you are processing user input, be sure to use a HTML sanitizer, such as [rehype-sanitize][rehype-sanitize].

  • rehype-to-notion — Transform HTML to Notion blocks
  • [rehype-sanitize][rehype-sanitize]
  • rehype — HTML processor powered by plugins part of the unified collective

License

GPL-3.0-or-later © Thomas F. K. Jorna

Keywords

FAQs

Package last updated on 09 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc