Skip to main content

API Reference

Noxion is distributed as five npm packages plus a CLI scaffolding tool. This section covers the public API surface and links to detailed package references.


Packages

PackagenpmPurpose
@noxion/corenpmConfig, data fetching, plugin system, TypeScript types
@noxion/notion-renderernpmNotion block renderer: 30+ block types, KaTeX SSR, Shiki syntax highlighting
@noxion/renderernpmReact components for rendering Notion content and blog UI
@noxion/adapter-nextjsnpmNext.js App Router integration: metadata, JSON-LD, sitemap, robots
create-noxionnpmCLI scaffolding tool (bun create noxion)

@noxion/core

The foundation package. Everything else depends on it.

Installation

npm install @noxion/core
# or
bun add @noxion/core

Exports

Config

ExportDescription
defineConfig(input)Create a validated NoxionConfig with defaults applied
loadConfig()Load config from noxion.config.ts at runtime

Data fetching

ExportDescription
createNotionClient(options)Create an authenticated Notion API client
fetchBlogPosts(client, pageId)Fetch all published posts from a database
fetchCollection(client, collection)Fetch published pages for a configured collection
fetchAllCollections(client, config)Fetch and flatten pages across all configured collections
fetchPostBySlug(client, pageId, slug)Fetch a single post by slug
fetchPage(client, pageId)Fetch a full Notion page's ExtendedRecordMap
fetchAllSlugs(client, pageId)Fetch all published post slugs

Slug utilities

ExportDescription
generateSlug(title)Generate a URL-safe slug from a title
parseNotionPageId(input)Normalize a Notion page ID into UUID format
buildPageUrl(slug)Ensure a leading / for a page URL
resolveSlug(post)Resolve a post slug with title fallback

Frontmatter

ExportDescription
parseFrontmatter(recordMap, pageId)Extract frontmatter from the first code block
parseKeyValuePairs(text)Parse key: value pairs from a string
applyFrontmatter(post, frontmatter)Apply frontmatter overrides to a BlogPost

Plugin system

ExportDescription
definePlugin(factory)Create a type-safe plugin factory
createAnalyticsPlugin(options)Built-in analytics plugin factory
createRSSPlugin(options)Built-in RSS plugin factory
generateRSSXml(posts, config, options?)Generate RSS 2.0 XML from blog pages
createCommentsPlugin(options)Built-in comments plugin factory

Advanced plugin runtime

ExportDescription
loadPlugins(entries)Instantiate and validate plugin entries
executeHook(plugins, hookName, args)Execute async plugin lifecycle hooks
executeTransformHook(plugins, hookName, initialValue, extraArgs)Execute transform hooks with chaining
executeRegisterPageTypes(plugins, registry)Register custom page types from plugins
executeRouteResolve(plugins, route)Resolve route through plugin pipeline
executeExtendSlots(plugins, initialSlots)Legacy slot extension pipeline

Types (re-exports)

ExportDescription
BlogPostNormalized post data type
NoxionConfigFull config type
NoxionConfigInputInput type for defineConfig()
ThemeMode"system" | "light" | "dark"
NoxionPluginPlugin interface
ExtendedRecordMapRe-export from notion-types

@noxion/notion-renderer

The low-level Notion block renderer. Powers @noxion/renderer's <NotionPage />. Use this directly when you need full control over rendering, custom block overrides, or want to embed Notion content outside the standard blog layout.

Installation

npm install @noxion/notion-renderer
# peer deps
npm install react notion-types notion-utils
# or
bun add @noxion/notion-renderer react notion-types notion-utils

Peer dependencies: react >= 18.0.0, notion-types >= 7.0.0, notion-utils >= 7.0.0

Setup

/* Import styles in your global CSS */
@import '@noxion/notion-renderer/styles';
@import '@noxion/notion-renderer/katex-css'; /* for math equations */

Main component

ExportDescription
<NotionRenderer />Top-level renderer — renders a full Notion page from an ExtendedRecordMap

Context & hooks

ExportDescription
NotionRendererProviderReact context provider for renderer state
useNotionRenderer()Access the renderer context (record map, URL mappers, theme, components)
useNotionBlock(blockId)Resolve and unwrap a block by ID from the record map

Block components

30+ individually exported block components. See Block Components for the full reference.

ExportNotion block type
TextBlocktext
HeadingBlockheader, sub_header, sub_sub_header
BulletedListBlockbulleted_list
NumberedListBlocknumbered_list
ToDoBlockto_do
QuoteBlockquote
CalloutBlockcallout
DividerBlockdivider
ToggleBlocktoggle
PageBlockpage
EquationBlockequation
CodeBlockcode
ImageBlockimage
VideoBlockvideo
AudioBlockaudio
EmbedBlockembed, gist, figma, tweet, maps, and more
BookmarkBlockbookmark
FileBlockfile
PdfBlockpdf
TableBlocktable
ColumnListBlockcolumn_list
ColumnBlockcolumn
TableOfContentsBlocktable_of_contents

Inline components

ExportDescription
<Text />Rich-text renderer — all inline decorations (bold, italic, links, colors, inline equations)
<InlineEquation />Inline KaTeX math expression

Shiki

ExportDescription
createShikiHighlighter(options?)Create a HighlightCodeFn with dual-theme Shiki
normalizeLanguage(lang)Map Notion language names to Shiki language IDs

Utilities

ExportDescription
formatNotionDate(dateValue)Format a Notion date object to a readable string
unwrapBlockValue(record)Unwrap { role, value } record map wrapper
getBlockTitle(block)Extract plain-text title from a block
cs(...classes)Conditional className joiner

@noxion/renderer

React UI components and theme system for rendering Notion content and blog UI.

Installation

npm install @noxion/renderer react react-dom
# or
bun add @noxion/renderer react react-dom

Peer dependencies: react >= 18.0.0, react-dom >= 18.0.0

Components

ExportDescription
<NotionPage />Render a full Notion page — wraps <NotionRenderer /> with Shiki, dark mode, image URL mapping
<NoxionLogo />Noxion logo component

Hooks

ExportDescription
useThemePreference()Returns and controls the user's theme preference (light/dark/system)
useSearch()Search hook

Types

ExportDescription
NoxionTheme, NoxionThemeTokensTheme token/type definitions
NoxionSlotMap, NoxionTemplateMap, NoxionTemplateProps, NoxionLayoutPropsLayout/template composition types
NoxionThemeMetadataTheme package metadata shape
PostCardProps, PostListProps, HeaderProps, FooterProps, etc.Component prop types (still exported for theme authors)

@noxion/adapter-nextjs

Next.js App Router integration utilities for SEO, metadata, structured data, and static generation.

Installation

npm install @noxion/adapter-nextjs @noxion/core
# or
bun add @noxion/adapter-nextjs @noxion/core

Peer dependencies: next >= 15.0.0

Metadata

ExportDescription
generateNoxionMetadata(post, config)Generate Next.js Metadata for a post page
generateNoxionListMetadata(config)Generate Next.js Metadata for the homepage

Structured Data (JSON-LD)

ExportDescription
generateBlogPostingLD(post, config)BlogPosting JSON-LD schema
generateBreadcrumbLD(post, config)BreadcrumbList JSON-LD schema
generateWebSiteLD(config)WebSite + SearchAction JSON-LD schema
generateCollectionPageLD(posts, config)CollectionPage + ItemList JSON-LD schema

Sitemap & Robots

ExportDescription
generateNoxionSitemap(posts, config)Generate MetadataRoute.Sitemap entries
generateNoxionRobots(config)Generate MetadataRoute.Robots
generateNoxionStaticParams(client, pageId)Generate { slug: string }[] for generateStaticParams()

Routing

ExportDescription
generateNoxionRoutes(config)Generate route configs from collections
resolvePageType(path, routes)Resolve route config from URL path
buildPageUrl(page, routes)Build URL path using route prefix
generateStaticParamsForRoute(pages, route)Generate params for one route type

Revalidation & Webhooks

ExportDescription
createRevalidateHandler(options)On-demand ISR revalidation route handler
createNotionWebhookHandler(options)Notion webhook route handler with signature verification

Dependency graph

@noxion/adapter-nextjs
└── @noxion/core
└── notion-client (unofficial Notion API)
└── notion-utils (utilities)
└── notion-types (TypeScript types)

@noxion/renderer
└── @noxion/notion-renderer (Notion block rendering)
└── katex (equation SSR)
└── shiki (syntax highlighting)
└── notion-types
└── notion-utils

These are the only significant runtime dependencies. Noxion intentionally keeps the dependency tree small. The @noxion/notion-renderer package replaced the previous react-notion-x dependency, giving full control over rendering and styling.


Versioning

All Noxion packages follow Semantic Versioning. They are versioned together (same major/minor version across all packages) to ensure compatibility. When upgrading, update all @noxion/* packages to the same version simultaneously.