Skip to content

Commit 86fd854

Browse files
authored
Merge pull request #2 from shellui-dev/feat/shelldocs-0.1.18
docs: ShellDocs 0.1.18 (colour presets, shelldocs preview)
2 parents 1dcdbc2 + 8285db6 commit 86fd854

25 files changed

Lines changed: 293 additions & 49 deletions

‎Llms/agent-rules.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ Read these before building or changing a ShellDocs site.
66
2. **Pages are Markdown files** in `content/docs/`, with `title` and `description` frontmatter. Each folder's `meta.json` sets the sidebar order and must list every page. `shelldocs add page|guide|component <name>` scaffolds one. New pages and `meta.json` edits need a restart of the running site.
77
3. **Use ShellDocs' components in Markdown; don't write HTML look-alikes.** `<Callout>`, `<Tabs>` / `<Tab>`, `<Steps>` / `<Step>`, `<CardGrid>` / `<Card>` / `<LinkCard>`, `<CodeGroup>`, `<FileTree>`, `<TypeTable>` / `<TypeRow>` and `<AutoTypeTable>`. When a site's own library has a component of the same name, the `Docs` prefix (`<DocsCallout>`) still reaches the built-in.
88
4. **Live examples:** a ```` ```razor:preview ```` fence, `<ComponentPreview>`, or `<DemoPreview Component="X" />` for a `.razor` file under `DemoSourceRoot`. A `razor:preview` body is Razor, not Markdown: use `<code>` and `<strong>`, not backticks and `**`. Components used in Markdown must be registered with `RegisterComponent<T>()` or `RegisterComponentsFromAssembly<T>()`.
9-
5. **Attribute values on tags in Markdown are plain text.** They aren't Markdown and HTML entities aren't decoded. There is no escape for the quote character, so switch between single and double quotes.
9+
5. **Attribute values on tags in Markdown are plain text, not Markdown.** HTML entities in them are decoded (`&amp;`, `&quot;`). For a value that holds double quotes, wrap it in single quotes or write `&quot;`.
1010
6. **Configuration lives in `AddShellDocs(o => ...)` in `Program.cs`:** site details, navigation, packages, versions, redirects, previews and `EnableLlmsTxt`.
1111
7. **Static sites come from `shelldocs build`.** Don't edit the `publish/` output by hand, and don't add `--spa-fallback` unless the host needs it: it replaces the not-found page with the home page.

‎README.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ content/
5959
authoring/ frontmatter, code fences, razor:preview, inline tags, navigation
6060
components/ one page per content primitive
6161
guides/ component libraries, versioning, redirects, search, llms.txt, not-found, deployment
62-
cli/ init, add, dev, build
62+
cli/ init, add, dev, build, preview
6363
theming.md
6464
packages/ one overview per NuGet package
6565
wwwroot/
6666
favicon.svg, favicon.png, apple-touch-icon.png
6767
brand/mark.svg the logo, read into LogoSvg in Program.cs
68-
demos/ static pages shown with <IframePreview>
68+
demos/ static pages shown with <IframePreview> (theme frame, colour presets)
6969
cli-replay.js the terminal replay on the home page
7070
copy-button.js copy buttons marked with data-copy
7171
Llms/
@@ -78,7 +78,7 @@ Components/
7878

7979
## Framework version
8080

81-
The site references `ShellDocs.* 0.1.17-alpha`. On a new release, bump the four package versions in `ShellDocs.Site.csproj` together.
81+
The site references `ShellDocs.* 0.1.18-alpha`. On a new release, bump the four package versions in `ShellDocs.Site.csproj` together.
8282

8383
## Deploying
8484

‎ShellDocs.Site.csproj‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
</PropertyGroup>
2020

2121
<ItemGroup>
22-
<PackageReference Include="ShellDocs.Components" Version="0.1.17-alpha" />
23-
<PackageReference Include="ShellDocs.Core" Version="0.1.17-alpha" />
24-
<PackageReference Include="ShellDocs.Markdown" Version="0.1.17-alpha" />
25-
<PackageReference Include="ShellDocs.Tokens" Version="0.1.17-alpha" />
22+
<PackageReference Include="ShellDocs.Components" Version="0.1.18-alpha" />
23+
<PackageReference Include="ShellDocs.Core" Version="0.1.18-alpha" />
24+
<PackageReference Include="ShellDocs.Markdown" Version="0.1.18-alpha" />
25+
<PackageReference Include="ShellDocs.Tokens" Version="0.1.18-alpha" />
2626
</ItemGroup>
2727

2828
<ItemGroup>

‎content/docs/authoring/component-tags.md‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,17 @@ A quoted value can hold anything except its own quote character. Angle brackets,
7878
Three things to know:
7979

8080
<TypeTable>
81-
<TypeRow Name="Quotes" Type="choose" Description="There is no escape for a quote inside a value. Wrap the value in single quotes when it contains double quotes, and the other way round." />
81+
<TypeRow Name="Quotes" Type="choose" Description="Wrap the value in single quotes when it contains double quotes, and the other way round. Or write the quote as an entity." />
8282
<TypeRow Name="Markdown" Type="literal" Description="Attribute text is not markdown. Backticks and asterisks show up as typed. Put formatted text in the tag body." />
83-
<TypeRow Name="HTML entities" Type="literal" Description="Entities are not decoded. Write the character itself." />
83+
<TypeRow Name="HTML entities" Type="decoded" Description="Entities are decoded, as Razor does. Before 0.1.18-alpha they showed literally." />
8484
</TypeTable>
8585

86+
```markdown
87+
<Callout Title="Tom &amp; Jerry say &quot;hi&quot;" />
88+
```
89+
90+
The title reads: Tom & Jerry say "hi". Entities inside a code span in the value, `@` expressions and directive attributes such as `@onclick` stay as written.
91+
8692
A tag whose quote is never closed, or that runs across a blank line, is treated as plain text rather than a component.
8793

8894
## Code spans stay code

‎content/docs/authoring/fenced-code.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ dotnet add package ShellDocs.Components --prerelease
109109
<CodeTab Label="PackageReference">
110110

111111
```xml
112-
<PackageReference Include="ShellDocs.Components" Version="0.1.17-alpha" />
112+
<PackageReference Include="ShellDocs.Components" Version="0.1.18-alpha" />
113113
```
114114

115115
</CodeTab>

‎content/docs/cli/build.md‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Rewrites the base href, replaces `404.html` with the home page, and adds the sit
5959
</Step>
6060
</Steps>
6161

62-
The project stays a normal Blazor Web App. Nothing about it changes for the export.
62+
The project stays a normal Blazor Web App. Nothing about it changes for the export. To check the result before deploying, run [`shelldocs preview`](/docs/cli/preview).
6363

6464
## Custom pages
6565

@@ -83,12 +83,14 @@ Without the flag none of these are written, so a local build never produces a si
8383

8484
### `--base-href`
8585

86-
For a site served from a subpath. Rewrites the `base` tag in every HTML file so assets resolve under the subpath. Include the leading and trailing slash.
86+
For a site served from a subpath. Rewrites the `base` tag in every HTML file so assets resolve under the subpath, and puts the subpath in front of every root-relative `href`, `src` and `data-src`, so links in the sidebar, header, breadcrumb, page content and prev/next stay inside the site. Include the leading and trailing slash.
8787

8888
```bash
8989
shelldocs build --base-href /my-repo/
9090
```
9191

92+
Before `0.1.18-alpha` only the `base` tag changed, and root-relative links such as `/docs/introduction` led out of the subpath. [`shelldocs preview`](/docs/cli/preview) serves the export under the subpath, to check it.
93+
9294
### `--spa-fallback`
9395

9496
Replaces `404.html` with a copy of the root `index.html`, so a host that serves `404.html` for unknown URLs shows the home page instead of the not-found page.
@@ -125,5 +127,6 @@ Search, the sidebar, tabs and the rest of the chrome work in the export: `shelld
125127

126128
<CardGrid Columns="2">
127129
<LinkCard Title="Deployment" Description="GitHub Pages workflow, custom domains, and .NET hosting." Href="/docs/guides/deployment" />
130+
<LinkCard Title="shelldocs preview" Description="Serve the export locally, as a static host would." Href="/docs/cli/preview" />
128131
<LinkCard Title="shelldocs dev" Description="Iterate locally before you publish." Href="/docs/cli/dev" />
129132
</CardGrid>

‎content/docs/cli/init.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ The single-page router that serves every `/docs/**` URL from the `.md` files und
4444
Deletes `Counter.razor`, `Weather.razor`, `NavMenu.razor`, `MainLayout.razor.css`, `Home.razor.css`. Rewrites `MainLayout.razor` as a bare pass-through and replaces `Home.razor` with the ShellDocs welcome page.
4545
</Step>
4646
<Step Title="Patches `Program.cs`">
47-
Adds `using ShellDocs.Components;`, `builder.WebHost.UseStaticWebAssets();`, and `builder.Services.AddShellDocs(...)` : anchoring on the exact template shape produced by `dotnet new blazor`. The `AddShellDocs` call turns on [llms.txt for AI agents](/docs/guides/llms-txt) with `o.EnableLlmsTxt(...)`, its options commented out.
47+
Adds `using ShellDocs.Components;`, `builder.WebHost.UseStaticWebAssets();`, and `builder.Services.AddShellDocs(...)` : anchoring on the exact template shape produced by `dotnet new blazor`. The `AddShellDocs` call turns on [llms.txt for AI agents](/docs/guides/llms-txt) with `o.EnableLlmsTxt(...)`, its options commented out, and sets the [colour preset](/docs/theming#colour-presets) from `--theme`.
4848
</Step>
4949
<Step Title="Patches `Components/App.razor`">
5050
Adds the `_content/ShellDocs.Tokens/tokens.css` and component CSS links, the theme-bootstrap script, and `shelldocs.js` + Shiki loader. Also switches `<Routes />` to `<Routes @rendermode="InteractiveServer" />` so interactive components (theme toggle, search, tabs) come alive.
@@ -103,7 +103,7 @@ A per-project setup guide with copy-paste snippets for the exact `AddShellDocs`,
103103
<TypeRow Name="--dir" Type="string" Default="cwd" Description="Working directory. With --attach, the project directory to augment." />
104104
<TypeRow Name="--attach" Type="bool" Default="false" Description="Attach mode : augment an existing Blazor project instead of creating one." />
105105
<TypeRow Name="--yes" Type="bool" Default="false" Description="Non-interactive : skip the GitHub-repo prompt, take defaults everywhere." />
106-
<TypeRow Name="--theme" Type="string" Default="shadcn" Description="Accepted values are shadcn, fuma and nextra. Has no effect in this release: every site gets the same tokens." />
106+
<TypeRow Name="--theme" Type="string" Default="graphite" Description="Colour preset: graphite, harbor, lagoon, forest, savanna, ember or jacaranda. Writes o.Theme = ShellDocsTheme.{Preset} into Program.cs; graphite, the default, leaves it as a commented-out example. See Theming." />
107107
</TypeTable>
108108

109109
## Exit codes

‎content/docs/cli/meta.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"title": "CLI",
3-
"pages": ["init", "add", "dev", "build"]
3+
"pages": ["init", "add", "dev", "build", "preview"]
44
}

‎content/docs/cli/preview.md‎

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
title: shelldocs preview
3+
description: Serve the output of shelldocs build locally, the way a static host would, to check an export before deploying it.
4+
order: 5
5+
---
6+
7+
# `shelldocs preview`
8+
9+
`shelldocs preview` serves the static site that [`shelldocs build`](/docs/cli/build) wrote, the way GitHub Pages, Netlify and Cloudflare Pages serve it. Use it to check an export before you deploy: links, the not-found page, search, a site built for a subpath.
10+
11+
## Synopsis
12+
13+
```bash
14+
shelldocs preview [--dir <dir>] [--output <path>] [--port <n>] [--base-href <path>]
15+
```
16+
17+
## Default use
18+
19+
Build, then preview, from the docs project folder:
20+
21+
```bash
22+
shelldocs build
23+
shelldocs preview
24+
```
25+
26+
The export in `./publish` is served at `http://localhost:5050`. Press `Ctrl+C` to stop.
27+
28+
## How it serves
29+
30+
<TypeTable>
31+
<TypeRow Name="A file" Type="200" Description="Served as it is, with a content type from its extension." />
32+
<TypeRow Name="A folder" Type="200" Description="Its index.html. Every page of an export is a folder with an index.html." />
33+
<TypeRow Name="{path}.html" Type="200" Description="Used when there is no file or folder of that name." />
34+
<TypeRow Name="Anything else" Type="404" Description="The export's 404.html, with a 404 status, as most static hosts do." />
35+
</TypeTable>
36+
37+
Nothing is cached, so after a rebuild a reload shows the new output. Requests can't reach files outside the export.
38+
39+
## Sites built for a subpath
40+
41+
An export built with `--base-href /my-repo/` is served under that path. `shelldocs preview` reads the base from the export's `index.html`, so it needs no flag:
42+
43+
```bash
44+
shelldocs build --base-href /my-repo/
45+
shelldocs preview
46+
```
47+
48+
The site is at `http://localhost:5050/my-repo/`, and `/` redirects there. Pass `--base-href` to serve under another path than the one the build wrote.
49+
50+
## Options
51+
52+
<TypeTable>
53+
<TypeRow Name="--dir" Type="string" Default="current folder" Description="Project folder. --output is relative to it." />
54+
<TypeRow Name="--output" Type="string" Default="publish" Description="The static site to serve, as passed to shelldocs build." />
55+
<TypeRow Name="--port" Type="int" Default="5050" Description="Port to listen on." />
56+
<TypeRow Name="--base-href" Type="string?" Default="the export's base href" Description="Path to serve the site under." />
57+
</TypeTable>
58+
59+
## Exit codes
60+
61+
<TypeTable>
62+
<TypeRow Name="0" Type="ok" Description="Stopped with Ctrl+C." />
63+
<TypeRow Name="1" Type="error" Description="No index.html in the output folder. Run shelldocs build first, or point --output at its folder." />
64+
</TypeTable>
65+
66+
The command needs the ASP.NET Core runtime, which any machine that builds a Blazor site already has. It was added in `0.1.18-alpha`, replacing an unfinished `preview <name>` placeholder.
67+
68+
## See also
69+
70+
<CardGrid Columns="2">
71+
<LinkCard Title="shelldocs build" Description="Write the static site this command serves." Href="/docs/cli/build" />
72+
<LinkCard Title="Deployment" Description="What works on a static host, and how to publish." Href="/docs/guides/deployment" />
73+
</CardGrid>

‎content/docs/components/card.md‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ The same attribute works on a `Card` written straight into the page:
4242

4343
<Card Title="Composable" IconSvg="<svg viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'><rect x='3' y='3' width='7' height='7' rx='1'/><rect x='14' y='3' width='7' height='7' rx='1'/><rect x='3' y='14' width='7' height='7' rx='1'/><rect x='14' y='14' width='7' height='7' rx='1'/></svg>" Description="An inline card with an icon." />
4444

45-
Write the markup itself, not HTML entities : attribute values are not decoded.
46-
4745
## With child content
4846

4947
Use `ChildContent` for anything richer than a description : lists, a code block, another primitive.

0 commit comments

Comments
 (0)