Quick start
Assumes you've already run dotnet tool install -g ShellDocs.CLI --prerelease. If not, hop over to Installation first.
- Scaffold
Pick a directory (empty or your existing repo), then:
bashshelldocs init MyDocsCreates a new Blazor Web App under
docs/MyDocs.Docs/, wires the ShellDocs packages, patchesProgram.cs, drops a startercontent/docs/introduction.md. One command → running docs site.Prefer to augment an existing Blazor project instead of scaffolding fresh? Use
--attach:bashshelldocs init --attach --dir path/to/your/blazor/projectAttach mode never patches your
Program.cs(respects your custom middleware / auth) : it emits aSHELLDOCS_SETUP.mdwith copy-paste snippets instead. - Run the dev serverbash
cd docs/MyDocs.Docs shelldocs devServes at http://localhost:5000 with hot reload on
.md,.razor, and.cschanges.Or, equivalently:
bashdotnet watch runshelldocs devis a thin wrapper : same underlying behavior, plus markdown-file watching baked in. - Open the site
Visit http://localhost:5000. You should see:
- Welcome pageHome.razor : customize this into your marketing page
- /docs/introductionthe starter page ShellDocs scaffolded for you
The sidebar auto-populates from your
content/docs/folder. The Introduction page renders your starter markdown with a live<Callout>component and syntax-highlighted code. - Add a new pagebash
shelldocs add component ButtonCreates
content/docs/components/button.mdwith frontmatter, arazor:previewskeleton, and an empty<TypeTable>for props documentation. Reload the browser : the page appears in the sidebar automatically. Nometa.jsonedit required.Other templates:
Prop Type Default Description component {Name}template— content/docs/components/{slug}.md : razor:preview + Props table + Notes guide {slug}template— content/docs/guides/{slug}.md : intro + Steps skeleton + Next section page {slug}template— content/docs/{slug}.md : blank frontmatter + H1 - Publish to static hostingbash
shelldocs build --output publishPrerenders every page into
publish/as static files. Upload the folder to any static host. See Deployment for a GitHub Pages workflow and for what needs a server instead.
What just happened
You now have a Blazor Web App with:
- File-based routing : drop a
.mdincontent/docs/, it becomes a page - Auto sidebar : the tree structure of
content/docs/becomes the nav - Live components :
razor:previewfences render real Blazor components inline - Search :
Cmd+Kopens the search dialog, on a .NET host and on a static export alike - Dark mode : theme toggle in the sidebar footer