JSPM

notion-html-blocks

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

Package Exports

    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