Skip to main content
Home

Built and signed on GitHub Actions

Import Notion pages into your Eleventy project

This package works with Node.js, Deno, Bun
This package works with Node.js
This package works with Deno
This package works with Bun
JSR Score
100%
Published
3 days ago (0.0.5)
type alias BlockFormatters

A set of function defining how to format a block into a string (usually a string of HTML). Each formatter receives three arguments; first, its contents, already stringified to HTML. For block types without content, such as the "divider" type or the "image" type, an empty string is passed. For the second argument, the children of the block is passed, as an already-formatted string of HTML. Again, for block types that cannot have children, such as a "paragraph" or "embed", an empty string is passed. Lastly, the third argument represents some contextual information about the block, such as the previous or next sibling block, its parent, its type, or, in some cases, some additional information about the specific block. This is helpful for some block types that are a little less straight-forward to stringify, such as bulleted list items (since they need to be surrounded by a <ul> as a group of siblings) or tables.

Properties

optional
paragraph: (
content: string,
children: "",
info: BaseBlockInfo<"paragraph">,
) => string
optional
heading1: (
content: string,
children: "",
info: BaseBlockInfo<"heading1">,
) => string
optional
heading2: (
content: string,
children: "",
info: BaseBlockInfo<"heading2">,
) => string
optional
heading3: (
content: string,
children: "",
info: BaseBlockInfo<"heading3">,
) => string
optional
bulletedListItem: (
content: string,
children: string,
info: BaseBlockInfo<"bulletedListItem">,
) => string
optional
numberedListItem: (
content: string,
children: string,
info: BaseBlockInfo<"numberedListItem">,
) => string
optional
quote: (
content: string,
children: string,
info: BaseBlockInfo<"quote">,
) => string
optional
toDo: (
content: string,
children: string,
info: BaseBlockInfo<"toDo"> & { checked: boolean; },
) => string
optional
toggle: (
content: string,
children: string,
info: BaseBlockInfo<"toggle"> & { color: string; },
) => string
optional
synced: (
content: "",
children: string,
info: BaseBlockInfo<"synced">,
) => string
optional
childPage: (
content: "",
children: "",
info: BaseBlockInfo<"childPage"> & { title: string; },
) => string
optional
childDatabase: (
content: "",
children: "",
info: BaseBlockInfo<"childDatabase"> & { title: string; },
) => string
optional
equation: (
content: "",
children: "",
info: BaseBlockInfo<"equation"> & { expression: string; },
) => string
optional
code: (
content: string,
children: "",
info: BaseBlockInfo<"code"> & { language: string; caption: { rich: string; plain: string; }; },
) => string
optional
callout: (
content: string,
children: string,
info: BaseBlockInfo<"callout"> & { color: string; },
) => string
optional
divider: (
content: "",
children: "",
info: BaseBlockInfo<"divider">,
) => string
optional
breadcrumb: (
content: "",
children: "",
info: BaseBlockInfo<"breadcrumb">,
) => string
optional
tableOfContents: (
content: "",
children: "",
info: BaseBlockInfo<"tableOfContents">,
) => string
optional
columnList: (
content: "",
children: string,
info: BaseBlockInfo<"columnList">,
) => string
optional
column: (
content: "",
children: string,
info: BaseBlockInfo<"column">,
) => string
optional
table: (
content: "",
children: string,
info: BaseBlockInfo<"table"> & { width: number; hasColumnHeader: boolean; hasRowHeader: boolean; },
) => string
optional
tableRow: (
content: "",
children: "",
info: BaseBlockInfo<"tableRow"> & { cells: string[]; },
) => string
optional
embed: (
content: "",
children: "",
info: BaseBlockInfo<"embed"> & { caption: { rich: string; plain: string; }; url: string; },
) => string
optional
bookmark: (
content: "",
children: "",
info: BaseBlockInfo<"bookmark"> & { caption: { rich: string; plain: string; }; url: string; },
) => string
optional
image: (
content: "",
children: "",
info: BaseBlockInfo<"image"> & { caption: { rich: string; plain: string; }; url: string; },
) => string
optional
video: (
content: "",
children: "",
info: BaseBlockInfo<"video"> & { caption: { rich: string; plain: string; }; url: string; },
) => string
optional
pdf: (
content: "",
children: "",
info: BaseBlockInfo<"pdf"> & { caption: { rich: string; plain: string; }; url: string; },
) => string
optional
file: (
content: "",
children: "",
info: BaseBlockInfo<"file"> & { caption: { rich: string; plain: string; }; url: string; },
) => string
optional
linkPreview: (
content: "",
children: "",
info: BaseBlockInfo<"linkPreview"> & { url: string; },
) => string

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@vrugtehagel/eleventy-from-notion

Import symbol

import { type BlockFormatters } from "@vrugtehagel/eleventy-from-notion";
or

Import directly with a jsr specifier

import { type BlockFormatters } from "jsr:@vrugtehagel/eleventy-from-notion";

Add Package

pnpm i jsr:@vrugtehagel/eleventy-from-notion
or (using pnpm 10.8 or older)
pnpm dlx jsr add @vrugtehagel/eleventy-from-notion

Import symbol

import { type BlockFormatters } from "@vrugtehagel/eleventy-from-notion";

Add Package

yarn add jsr:@vrugtehagel/eleventy-from-notion
or (using Yarn 4.8 or older)
yarn dlx jsr add @vrugtehagel/eleventy-from-notion

Import symbol

import { type BlockFormatters } from "@vrugtehagel/eleventy-from-notion";

Add Package

npx jsr add @vrugtehagel/eleventy-from-notion

Import symbol

import { type BlockFormatters } from "@vrugtehagel/eleventy-from-notion";

Add Package

bunx jsr add @vrugtehagel/eleventy-from-notion

Import symbol

import { type BlockFormatters } from "@vrugtehagel/eleventy-from-notion";