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,generateFeed,generateLlmsTxt,generateLlmsFullTxt, 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, search, llms and changelog indexes, plus 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/llms: the generated per-page markdown index, exported asdocs(see SEO).svelte-docsmith/changelog: the generated release index, exported asreleases(see Changelog).svelte-docsmith/mermaid: the diagram component, imported for you by a```mermaidfence. You never import it directly.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.
docsmith() preprocessor
From svelte-docsmith/preprocess, registered in svelte.config.js. It bundles
mdsvex, Shiki, heading anchors and the page layout, so markdown compiles to real
routes. Every option has a working default; pass none and it does the right
thing.
extensions string[] default ['.md']themes { light: string; dark: string } default github-light / github-darkthemes for live example source; set
both to the same pair or the two will not match.langs string[] layout stringfalse false for none. A
custom layout must export a pre component from its module
script, since code fences render through it.lineNumbers boolean default falseshowLineNumbers or noLineNumbers.twoslash boolean default falsetwoslash. Needs the optional
peer dependencies; see Code blocks.remarkPlugins PluggableList rehypePlugins PluggableList docsmith() Vite plugin
From svelte-docsmith/vite, added to plugins in vite.config.ts. It scans
your pages into the generated indexes and serves the ?source imports that Live Examples use.
content string default 'src/routes/docs'routes string default 'src/routes'themes { light: string; dark: string } default github-light / github-dark?source render behind Live Examples. Separate from the
preprocessor's themes, because the two run from different
config files; set them to the same pair or your example source will not
match your code blocks.changelog stringfalse default 'CHANGELOG.md'false to skip it.changelogPath string default '/changelog'DocsShell
The full documentation shell: header, sidebar, content area, and table of contents.
config required DocsmithConfig defineConfig above).content required DocsContentItem[] children required Snippet versions ResolvedVersion[] default []search (versionId?: string) => Promise<SearchDoc[]> () => import('svelte-docsmith/search').then((m) => m.docs).
Receives the active version id on a versioned site.
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'versions ResolvedVersion[] default []DocsShell. Pass it so an error
under an archived prefix keeps that version's search scope and noindex.search (versionId?: string) => 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.ResolvedVersion: one entry of the generated version manifest. See Versioning.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.