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
5 days ago (0.0.5)
T
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.

T
BlockInfo

The exact info argument for a certain block type, or generically for all block types if the type parameter is omitted.

T
BuilderOptions

Options passed to the page builder class. Configures the underlying Notion client. Structural options and formatting options are passed to individual methods.

T
BuildOptions

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

f
default

The main Eleventy plugin. Add this to your Eleventy config file using

T
EleventyFromNotionOptions

To use the plugin, you must pass an options object configuring a few things, such as your integration secret, your Notion database ID or URL, a schema for processing your Notion page properties, and optionally formatters to adjust the way rich text or blocks are converted to HTML.

T
EleventyOptions

As part of the Eleventy build process, Notion is queried for updated Notion pages, and they are processed and written into a special folder. The filenames for the templates match the Notion page UUID, without the dashes. The extension is .html by default, but can be configured using the extension option. By default, these Notion templates are put into the notion/ folder under your Eleventy input directory. Note that the templates are only updated as part of an Eleventy "build" run, not when serving or watching.

T
FrontMatter

Notion page properties are mapped to JSON-compatible objects, to be used in a page's front matter (metadata). Most conversions are fairly straight-forward, such as a "checkbox" type outputting a boolean, but some are a bit more specific:

T
InlineFormatters

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.

c
NotionPageBuilder

A class that interacts with the Notion SDK to be an easy-to-work-with front for retrieving page front matter and content.

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.