Quick Start
Wire up the pipeline and render your first page.
Three steps take you from an installed package to a live docs page in the sidebar. Each one edits a single file.
Scaffolding a new project?
npm create svelte-docsmith does every step on this page for you. This walk
through is for adding DocSmith to an existing app, or for understanding the
pieces. See Installation for the scaffolder.
Configure Vite
DocSmith is one Vite plugin, docsmith() from svelte-docsmith/vite, and it is
the only place your docs are configured. It compiles your .md pages (mdsvex,
Shiki highlighting with a generous language set, heading anchors, and the
DocSmith page layout), scans their frontmatter into the sidebar, and powers live
examples. Give it your site’s title, put it before sveltekit(), and add .md to SvelteKit’s extensions so markdown pages become routes:
Every other option, from code block themes to versioning, goes in the same call. See Configuration.
On SvelteKit 2?
DocSmith supports SvelteKit 2 and 3. On SvelteKit 2, extensions goes in svelte.config.js instead, and you import your own files from $lib rather
than #lib. docsmith() stays in vite.config.ts.
Add the shell
In src/routes/docs/+layout.svelte, render DocsShell. It builds the sidebar
from the generated content index, so there is no nav array to maintain, and it
reads your site options itself:
Write a page
Create src/routes/docs/getting-started/+page.md. The frontmatter drives the
sidebar; everything below it is your content:
What you end up with
Those files sit exactly here:
- vite.config.ts
- src
- app.css
- routes
- docs
- +layout.svelte
- getting-started/+page.md
- docs
That's the whole loop
Drop a markdown file under src/routes/docs/ and it appears in the sidebar,
styled, highlighted, with breadcrumbs and a table of contents. To embed a
running component, see Writing pages, which covers
frontmatter, live examples, and code highlighting in full.