/api
API reference
Choose the correct package entry first, then find the function or type for the task at hand.
Most applications start with the generated createDecks(config)
The src/decks.ts facade created in the getting-started guide is the boundary between generated modules and public APIs. You do not need to compose low-level APIs just to render a deck.
hono-decks- Worker-safe runtime APIs for Hono applications. This is the normal entry.
hono-decks/advanced- Low-level APIs for custom sources, routers, and renderers.
hono-decks/node- Filesystem and compiler APIs for builds only. Never import this entry in Worker runtime code.
hono-decks/client- Island hydration. Generated client code normally uses it for you.
Runtime entry
Import these APIs from hono-decks in Hono and Worker code. Start with the generated facade, and use a direct API only when the facade does not cover your use case.
defineDecksConfig
hono-decksDefines the shared CLI and runtime configuration.
Use it whenKeeping mount path, build input, and runtime policy in one file.
import { defineDecksConfig } from "hono-decks"
defineDecksConfig(config: DecksConfig): DecksConfigConfiguredDecks
hono-decksThe application kit returned by generated createDecks(config).
Use it whenUsing routes, custom pages, and URLs from one config.
import type { ConfiguredDecks } from "hono-decks"
interface ConfiguredDecks { mountPath; source; router(); context(); paths(slug) }createDeckPaths
hono-decksCreates every public URL for one deck.
Use it whenCreating a path map outside a configured kit.
import { createDeckPaths } from "hono-decks"
createDeckPaths(mountPath, slug): DeckPathsdecksRouter
hono-decks/advancedBuilds a low-level router from a custom DeckSource.
Use it whenBuilding a custom pipeline without generated createDecks(config).
import { decksRouter } from "hono-decks/advanced"
decksRouter(options: DecksRouterOptions): HonoRendering and extension
Decompose and extend the default UI or replace its asset source.
createDeckViewerParts
hono-decks/advancedReturns viewer parts independently.
Use it whenComposing a fully custom viewer layout.
import { createDeckViewerParts } from "hono-decks/advanced"
createDeckViewerParts(input): Promise<DeckViewerParts>createDeckViewerEmbed
hono-decksCreates an embedded viewer with scoped CSS and runtime behavior.
Use it whenEmbedding a viewer directly in a custom page. Use the router embed option for an external iframe route.
import { createDeckViewerEmbed } from "hono-decks"
createDeckViewerEmbed(input: DeckViewerEmbedOptions): Promise<DeckViewerEmbed>withR2Assets
hono-decksWraps generated assets with an R2-backed source.
Use it whenMoving generated asset delivery to Cloudflare R2 without changing relative MDX paths.
import { withR2Assets } from "hono-decks"
withR2Assets(source: DeckSource, options: R2AssetSourceOptions): DeckSourcedefineSlideComponents
hono-decksCreates a typed registry for built-in and application components.
Use it whenRegistering shared components across decks or replacing built-ins. Keep deck-specific components under components/.
import { defineSlideComponents } from "hono-decks"
defineSlideComponents(input: Record<string, SlideComponentInput>): SlideComponentRegistryrenderCompiledDeckAsync
hono-decks/advancedRenders a compiled deck directly.
Use it whenBuilding a low-level custom rendering pipeline.
import { renderCompiledDeckAsync } from "hono-decks/advanced"
renderCompiledDeckAsync(deck: CompiledDeck, input?): Promise<string>Configuration and model types
Types for public surfaces, shared HTML policy, and custom DeckSource implementations.
DeckViewerOpenGraphOptions
hono-decksConfigures the viewer's Open Graph and Twitter Card image from the canonical path or a resolver.
Use it whenConnecting a build-generated or CDN-hosted image to viewer social metadata.
import type { DeckViewerOpenGraphOptions } from "hono-decks"
interface DeckViewerOpenGraphOptions { imagePath?: string | (({ deck, paths }) => MaybePromise<string | undefined>) }DecksRouterPagesOptions
hono-decksConfigures index rendering and HTML route surfaces per request.
Use it whenDisabling unused public surfaces or gating them by authentication and environment.
import type { DecksRouterPagesOptions } from "hono-decks"
interface DecksRouterPagesOptions { index?; viewer?; render?; print?; presentation?; presenter? }DeckRouteSurfaceInput
hono-decksPasses Hono context, deck, mount path, and dev state into route gates.
Use it whenTyping a reusable pages resolver defined outside the router configuration.
import type { DeckRouteSurfaceInput } from "hono-decks"
interface DeckRouteSurfaceInput { c; surface; mountPath; dev; deck?; slug? }DeckDocumentOptions
hono-decksDefines language, nonce, head content, and per-surface overrides.
Use it whenApplying lang, CSP nonce, or head elements to every generated HTML surface.
import type { DeckDocumentOptions } from "hono-decks"
interface DeckDocumentOptions extends DeckDocumentPageOptions { surfaces? }DeckExternalEmbedOptions
hono-decksOpts into an external iframe document route with explicit policy.
Use it whenEmbedding decks on another origin with explicit parent origins and viewer settings.
import type { DeckExternalEmbedOptions } from "hono-decks"
interface DeckExternalEmbedOptions { frameAncestors?; document?; viewer? }DeckSource
hono-decksSeparates runtime deck and asset access from storage implementations.
Use it whenLoading decks outside the generated manifest or implementing a custom storage source.
import type { DeckSource } from "hono-decks"
interface DeckSource { listDecks(c); getCompiledDeck(c, slug); getAsset?(c, slug, path) }Node and client entries
Filesystem/compiler APIs live in the Node entry; hydration lives in the client entry.
compileDecks
hono-decks/nodeCompiles filesystem decks and emits the manifest and generated modules.
Use it whenCalling the compiler from a custom build script or plugin. Most projects use the hono-decks compile CLI.
import { compileDecks } from "hono-decks/node"
compileDecks(input: CompileDecksInput): Promise<DeckManifest>createLocalDeckIO
hono-decks/nodeKeeps dev-only raw deck I/O separate from the runtime DeckSource.
Use it whenBuilding custom deck editing or preview tooling. It does not belong in ordinary runtime code.
import { createLocalDeckIO } from "hono-decks/node"
createLocalDeckIO(input: CreateLocalDeckIOInput): LocalDeckIOhydrateSlideIslands
hono-decks/clientHydrates interactive islands from the generated client entry.
Use it whenBuilding a custom client delivery pipeline. The generated client entry normally calls it for you.
import { hydrateSlideIslands } from "hono-decks/client"
hydrateSlideIslands(input: HydrateSlideIslandsInput): void