JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 63
  • Score
    100M100P100Q67303F
  • License ISC

Package Exports

  • notion-html-blocks
  • notion-html-blocks/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (notion-html-blocks) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

notion-html-blocks

notion-html-blocks is a zero-dependency library capable of rendering blocks from the Notion API into HTML. Through the use of the Notion SDK for JavaScript it's possible to extract specific page blocks which then can be converted into HTML content like this:

import { renderBlocks } from 'notion-html-block'

const pageBlocks = await notion.blocks.children.list({ block_id: id });

renderBlocks(pageBlocks);

Example output for toggleable heading block:

<h1 class="n-heading-1 n-toggleable n-toggleable-closed">Toggle Heading</h1>

Motivation

It`s could be useful when you want to use Notion like CMS for your project

Supported types:

  • divider
  • code
  • image
  • bulleted_list_item
  • paragraph
  • heading_1
  • heading_2
  • heading_3
  • numbered_list_item
  • quote
  • toggle
  • callout
  • table