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 weeks ago (0.0.5)
type alias 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.

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.

All of these are optional; each of them has a fallback. By default, the types are transformed to HTML using the following mapping:

  • link becomes <a href=…>;
  • bold becomes <strong>;
  • italic becomes <em>;
  • strikethrough becomes <s>;
  • underline becomes <b>;
  • code becomes <code>;
  • color becomes <mark class=…>

In particular I've chosen underlined text to become <b>, not <u>, because the latter is rarely semantically accurate (or useful, for that matter) whereas <b>, the "bring to attention" element, more accurately represents how I expect most people to use underlined text. To make sure this is visually reflected in your HTML pages, use font-weight: normal; together with text-decoration: underline.

Properties

optional
bold: (
content: string,
info: { },
) => string
optional
italic: (
content: string,
info: { },
) => string
optional
strikethrough: (
content: string,
info: { },
) => string
optional
underline: (
content: string,
info: { },
) => string
optional
code: (
content: string,
info: { },
) => string
optional
color: (
content: string,
info: { color: 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 InlineFormatters } from "@vrugtehagel/eleventy-from-notion";
or

Import directly with a jsr specifier

import { type InlineFormatters } 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 InlineFormatters } 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 InlineFormatters } from "@vrugtehagel/eleventy-from-notion";

Add Package

npx jsr add @vrugtehagel/eleventy-from-notion

Import symbol

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

Add Package

bunx jsr add @vrugtehagel/eleventy-from-notion

Import symbol

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