Configuration
Package exports, the config object, and the two shell components.
Everything you wire up once: what the package exports, the config object you pass
to the shell, and the two page-level components that own the site chrome. Props
for the authoring components (Callout, Tabs, Badge, and the rest) live on
their own pages in the Components section.
Package exports
svelte-docsmith: every component, plusdefineConfig,createSearchEngine,generateSitemap, and the types. Components are documented in Components; the rest is below.svelte-docsmith/preprocess: the mdsvex + Shiki preprocessor forsvelte.config.js.svelte-docsmith/vite: the Vite plugin (content index, search index, and the?sourcetransform).svelte-docsmith/content: the generated sidebar index, exported asdocs.svelte-docsmith/search: the generated full-text search index, exported asdocs(lazy-load it; see Search).svelte-docsmith/theme.css: the base style contract.svelte-docsmith/themes/*.css: the pre-installed theme presets (see Theming).
defineConfig
Validates a DocsmithConfig and returns it unchanged, throwing a clear error on
an invalid or dynamically-built config instead of rendering a blank header.
title required string <title> suffix.description string url string <link rel="canonical"> and absolute Open Graph URLs.ogImage string url).editUrl string https://github.com/you/repo/edit/main/apps/docs. Each page's source
path is appended. (“Last updated” is added from git automatically.)github string version string logo string nav DocsmithLink[] announcement { text, tag?, href?, external?, id?, dismissible? } text is required; add a tag for a leading pill (e.g. "New") and an href to link it. It's dismissible by default and stays dismissed
until you change id (or the text), so bump id to
re-show a new announcement.footer { copyright?, columns?, poweredBy? } This site runs one: the thin bar above the header is config.announcement. Its id tracks the library version, so it returns after each release and stays out
of the way in between. Dismiss it and it holds until the next version.
DocsShell
The full documentation shell: header, sidebar, content area, and table of contents.
config required DocsmithConfig defineConfig above).content required DocsContentItem[] children required Snippet search () => Promise<SearchDoc[]> () => import('svelte-docsmith/search').then((m) => m.docs).
See Search.seo { title?: string; description?: string } logo Snippet actions Snippet footer Snippet pattern boolean default falsecopyPage boolean default false.md, or open in ChatGPT / Claude). Needs the .md endpoint. See SEO.readingTime boolean default truefalse to hide it.feedback boolean | ((vote: 'up' | 'down', path: string) => void) true for the UI alone, or a callback to record votes (wire it to
your analytics). Omit to hide it.layout 'docs''page' default 'docs'docs is the three-column shell; page is full-bleed
content with the same header and footer but no sidebar or TOC.Theming needs no setup
ThemeProvider and ThemeToggle handle light and dark with no consumer wiring. DocsShell mounts the provider internally, so you never touch mode-watcher yourself. Use ThemeProvider directly to wrap a page you build outside DocsShell.
ErrorPage
A styled 404 / error screen that keeps the site chrome (header, search, footer,
theme). Drop it into a SvelteKit +error.svelte:
config required DocsmithConfig DocsShell, so the chrome matches.content DocsContentItem[] default []status number default page.statustitle string default from statusmessage string default page.error.messagehome string default '/'homeLabel string default 'Back to home'search () => Promise<SearchDoc[]> DocsShell).Types
DocsmithConfig: the config object above.DocsContentItem: a content-index entry withtitle,path, and optionalsection,order,description,toc.SearchDoc/SearchResult/SearchEngine: the search index entry and the shape returned bycreateSearchEngine.CalloutVariant/BadgeVariant: the intent unions forCalloutandBadge.
The vendored shadcn primitives and internal helpers (the TOC engine, the clipboard utility, the markdown renderer map) are not part of the public API and may change between releases.