Skip to main content

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 weeks ago (0.0.4)

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.

type alias BuildOptions

Options determining how a Notion page transforms into an object of metadata (front matter) and a string of HTML.

Properties

schema: Array<{ name: string; rename?: string | string[]; }>

Maps a page property in Notion to a key in the generated object of metadata. The name option must match the name of the page property (i.e. database column) in Notion. The property's value is then placed under the key or path specified by rename (which defaults to the value in name). When rename is specified as an array of strings, then the property is nested under the specified keys.

For example, if we specify name: "SEO description" together with rename: ["seo", "description"], then the value of the "SEO description" field in Notion can be accessed using the metadata by accessing the nested seo.description` property.

optional
formatters: { inline?: InlineFormatters; block?: BlockFormatters; }

The formatters to use for both inline text (Notion calls this "rich text") and blocks.

For inline formatting, sensible fallbacks are set in an attempt to generate somewhat semantic HTML by default. However, each type can be overwritten to allow for completely custom rich text stringification. Technically, it doesn't even need to stringify to HTML.

Note

Due to limitations in the Notion API, it is impossible to support both text colors as well as background colors for text. As such, text colors are not supported. The color formatter refers to text background colors only. Text colors are ignored, but using them can break the processing of specified background colors.

For block formatting, there are types that do not have a fallback, because there is not always a default that makes sense for the majority of users. When the builder encounters a block of a type that is not specified and does not have a fallback, a warning is logged and the block (including all of its children) are ignored. To prevent this, you must specify your own block formatter of the type in question.

Add Package

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

Import symbol

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

---- OR ----

Import directly with a jsr specifier

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

Add Package

npx jsr add @vrugtehagel/eleventy-from-notion

Import symbol

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

Add Package

yarn dlx jsr add @vrugtehagel/eleventy-from-notion

Import symbol

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

Add Package

pnpm dlx jsr add @vrugtehagel/eleventy-from-notion

Import symbol

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

Add Package

bunx jsr add @vrugtehagel/eleventy-from-notion

Import symbol

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