Quick Start
Wire up the pipeline and render your first page.
Four 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.
Register the markdown pipeline
In svelte.config.js, add .md to your extensions and call docsmith(). It
bundles mdsvex, Shiki highlighting with a generous language set, heading
anchors, and the DocSmith page layout:
Add the Vite plugin
In vite.config.ts, add docsmith(). It scans your pages’ frontmatter into the svelte-docsmith/content module and powers live examples:
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:
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 four files sit exactly here:
- svelte.config.js
- 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.