Skip to content

Commit 8285db6

Browse files
committed
docs: entities in attributes are decoded; state services removed
Since 0.1.18 HTML entities in component attribute values are decoded, so the inline-tags page, the Card page and the agent rules no longer say they stay literal. The search page says SearchState, SidebarCollapseState and MobileNavState are gone.
1 parent 17a52cc commit 8285db6

4 files changed

Lines changed: 10 additions & 6 deletions

File tree

‎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.

‎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/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.

‎content/docs/guides/search.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ shelldocsSearch.close();
7171
## Upgrading from before 0.1.15
7272

7373
<Callout Variant="warning" Title="Two things changed">
74-
`shelldocsSearch.init` is gone. If your own script called it, remove the call: search sets itself up. The `SearchState` service is still registered so existing code compiles, but nothing reads it any more. Open search with `data-search-open` or `shelldocsSearch.open()` instead.
74+
`shelldocsSearch.init` is gone. If your own script called it, remove the call: search sets itself up. Open search with `data-search-open` or `shelldocsSearch.open()`. The `SearchState` service stayed registered until `0.1.17-alpha` so old code compiled, but nothing read it; `0.1.18-alpha` removed it, with `SidebarCollapseState` and `MobileNavState`. Code that injects one needs its own copy.
7575
</Callout>
7676

7777
For search to work in a static export, both the packages the site references and the `ShellDocs.CLI` that builds it must be `0.1.15-alpha` or later. `shelldocs build` prints a warning when the site doesn't serve an index.

0 commit comments

Comments
 (0)