Skip to content

Commit 8ccd913

Browse files
committed
docs: update content for ShellDocs 0.1.12
Source examples are plain four-backtick fences again, now that longer fences are read correctly. Documents longer and tilde fences, relaxes the inline attribute rules (quoted values can hold '>' and other tags), shows an inline Card with an SVG icon, and lets TypeTable rows share a name. Version strings move to 0.1.12-alpha.
1 parent 1b6373b commit 8ccd913

19 files changed

Lines changed: 158 additions & 119 deletions

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

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,20 @@ More prose.
3232

3333
An inline tag's body goes through the markdown pipeline: inline code, emphasis, links, lists, fenced code and further component tags all work. Leave a blank line between a tag and a fenced block.
3434

35-
<pre><code class="language-markdown">&lt;Steps&gt;
36-
&lt;Step Title="Install"&gt;
35+
````markdown
36+
<Steps>
37+
<Step Title="Install">
3738

38-
&#96;&#96;&#96;bash
39+
```bash
3940
dotnet tool install -g ShellDocs.CLI --prerelease
40-
&#96;&#96;&#96;
41+
```
4142

42-
&lt;/Step&gt;
43-
&lt;Step Title="Scaffold"&gt;
44-
&#96;shelldocs init MyDocs&#96; creates a working site.
45-
&lt;/Step&gt;
46-
&lt;/Steps&gt;
47-
</code></pre>
43+
</Step>
44+
<Step Title="Scaffold">
45+
`shelldocs init MyDocs` creates a working site.
46+
</Step>
47+
</Steps>
48+
````
4849

4950
This is the opposite of a [`razor:preview`](/docs/authoring/razor-preview) fence, whose body is Razor. The rule of thumb: a tag in the page is content, a fence is an example of code.
5051

@@ -68,16 +69,21 @@ A tag with no body closes itself with `/>`.
6869

6970
Values are converted to each parameter's type, the same way a fence converts them: `Columns="3"` becomes an `int`, `External="true"` a `bool`, `Variant="warning"` an enum member.
7071

71-
Keep inline attribute values to plain text:
72+
A quoted value can hold anything except its own quote character. Angle brackets, another tag, and text that looks like an attribute all stay inside the value:
73+
74+
```markdown
75+
<Callout Title="a -> b" Text='rewrites href="/" on every page' />
76+
```
77+
78+
Three things to know:
7279

7380
<TypeTable>
74-
<TypeRow Name="Angle brackets" Type="avoid" Description="The tag ends at the first closing angle bracket, so a value containing one cuts the tag short and the component is dropped." />
75-
<TypeRow Name="HTML entities" Type="avoid" Description="Entities are not decoded. They show up as typed." />
76-
<TypeRow Name="Backticks" Type="avoid" Description="Attribute text is not markdown. Backticks show up as typed." />
77-
<TypeRow Name="Escaped quotes" Type="avoid" Description="There is no escape for a double quote inside a value. Rephrase, or use single quotes in the text." />
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." />
82+
<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." />
7884
</TypeTable>
7985

80-
When a value needs any of those, move the content into the tag body, or write the example as a `razor:preview` fence, where raw markup in attributes is fine.
86+
A tag whose quote is never closed, or that runs across a blank line, is treated as plain text rather than a component.
8187

8288
## Code spans stay code
8389

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

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ Fenced code blocks (` ``` `) are the workhorse of docs authoring. ShellDocs wrap
1212

1313
Standard CommonMark : three backticks, a language name, the code, three backticks.
1414

15-
<pre><code class="language-markdown">&#96;&#96;&#96;csharp
15+
````markdown
16+
```csharp
1617
var pipeline = new MarkdownPipelineBuilder()
1718
.UsePipeTables()
1819
.Build();
19-
&#96;&#96;&#96;
20-
</code></pre>
20+
```
21+
````
2122

2223
Renders as:
2324

@@ -41,11 +42,12 @@ Every fence gets a copy button in the top-right. Click copies the raw text : lan
4142

4243
Fences without a language tag still render : just no badge and no highlighting. Useful for shell prompts or ad-hoc text.
4344

44-
<pre><code class="language-markdown">&#96;&#96;&#96;
45+
````markdown
46+
```
4547
$ shelldocs init MyDocs
4648
✓ Wrote 12 change(s):
47-
&#96;&#96;&#96;
48-
</code></pre>
49+
```
50+
````
4951

5052
Renders as:
5153

@@ -62,9 +64,31 @@ Four-space-indented code blocks still work (CommonMark supports them) but you lo
6264

6365
Backtick-wrapped inline code (`` `like this` ``) is styled but has no copy button or language handling. Use it for identifiers, short snippets, and API references : `<Callout>`, `AddShellDocs()`, `Program.cs`.
6466

65-
## Interactions with other markdown
67+
## Longer fences and tildes
68+
69+
A fence is three or more backticks, closed by a run at least as long. Inside it everything is verbatim : no markdown parsing, no component tags, no previews.
70+
71+
To show a fence as an example, as this page does, wrap it in a longer one:
72+
73+
`````markdown
74+
````markdown
75+
```csharp
76+
var x = 1;
77+
```
78+
````
79+
`````
80+
81+
Tilde fences work the same way and save counting backticks:
82+
83+
````markdown
84+
~~~markdown
85+
```razor:preview
86+
<Callout>Shown as source, not rendered.</Callout>
87+
```
88+
~~~
89+
````
6690

67-
Inside a fence, the content is **verbatim** : no markdown parsing, no HTML entity handling. You can put anything inside : Razor tags, JSX, YAML, another fence's opening marker. The parser handles nested backtick counts via CommonMark's rule (outer fence needs one more backtick than any inner sequence).
91+
A component tag or a `razor:preview` fence inside a longer fence stays literal, and whatever follows the block on the page renders normally.
6892

6993
## The `razor:preview` fence
7094

@@ -85,7 +109,7 @@ dotnet add package ShellDocs.Components --prerelease
85109
<CodeTab Label="PackageReference">
86110

87111
```xml
88-
<PackageReference Include="ShellDocs.Components" Version="0.1.11-alpha" />
112+
<PackageReference Include="ShellDocs.Components" Version="0.1.12-alpha" />
89113
```
90114

91115
</CodeTab>
@@ -95,21 +119,6 @@ For panels that are not code, use [Tabs](/docs/components/tabs).
95119

96120
Full docs: [CodeGroup](/docs/components/code-group).
97121

98-
## Showing a fence as an example
99-
100-
To show the markdown for a fence, as this page does, don't nest it in a longer fence. ShellDocs scans for three-backtick fences before markdown is parsed, and a four-backtick block that contains one puts the scanner out of step: the next `razor:preview` on the page renders as plain code.
101-
102-
Write the example as an HTML code block instead, with the backticks and angle brackets as entities:
103-
104-
```html
105-
<pre><code class="language-markdown">&#96;&#96;&#96;csharp
106-
var x = 1;
107-
&#96;&#96;&#96;
108-
</code></pre>
109-
```
110-
111-
It gets the same frame, language badge and copy button as a fenced block.
112-
113122
## What ShellDocs doesn't do
114123

115124
- **Line numbers** : no first-class support. Add them by wrapping the fence in a custom component if you need them.

‎content/docs/authoring/index.md‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ Everything ShellDocs asks of you as an author lives here : the frontmatter field
1212

1313
A ShellDocs page is a `.md` file under `content/`. Drop one in, it appears in the sidebar automatically : no registration, no import, no meta.json edit required.
1414

15-
<pre><code class="language-markdown">---
15+
````markdown
16+
---
1617
title: My Page
1718
description: What this page is about.
1819
order: 3
@@ -22,20 +23,20 @@ order: 3
2223

2324
Regular markdown. Fenced code blocks:
2425

25-
&#96;&#96;&#96;csharp
26+
```csharp
2627
var x = 1;
27-
&#96;&#96;&#96;
28+
```
2829

2930
Inline components mid-prose:
3031

31-
&lt;Callout Variant="tip"&gt;Something worth calling out.&lt;/Callout&gt;
32+
<Callout Variant="tip">Something worth calling out.</Callout>
3233

3334
Live component demos:
3435

35-
&#96;&#96;&#96;razor:preview
36-
&lt;Button Variant="primary"&gt;Click me&lt;/Button&gt;
37-
&#96;&#96;&#96;
38-
</code></pre>
36+
```razor:preview
37+
<Button Variant="primary">Click me</Button>
38+
```
39+
````
3940

4041
That's the whole surface area for authoring.
4142

‎content/docs/authoring/razor-preview.md‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ A `razor:preview` fence renders its contents as live components and shows the sa
1010

1111
## Basic use
1212

13-
<pre><code class="language-markdown">&#96;&#96;&#96;razor:preview
14-
&lt;Callout Variant="tip" Title="Live example"&gt;
13+
````markdown
14+
```razor:preview
15+
<Callout Variant="tip" Title="Live example">
1516
This renders as a real Callout component.
16-
&lt;/Callout&gt;
17-
&#96;&#96;&#96;
18-
</code></pre>
17+
</Callout>
18+
```
19+
````
1920

2021
```razor:preview
2122
<Callout Variant="tip" Title="Live example">
@@ -106,10 +107,11 @@ Type arguments use C# spellings: `int?`, `List<string>`, or a simple or full typ
106107

107108
Add `stretch` or `scroll` after the language to change how the example sits in the frame.
108109

109-
<pre><code class="language-markdown">&#96;&#96;&#96;razor:preview stretch
110-
&lt;TypeTable&gt;…&lt;/TypeTable&gt;
111-
&#96;&#96;&#96;
112-
</code></pre>
110+
````markdown
111+
```razor:preview stretch
112+
<TypeTable>…</TypeTable>
113+
```
114+
````
113115

114116
<TypeTable>
115117
<TypeRow Name="razor:preview" Type="center" Description="Centred, sized to its content. The default." />

‎content/docs/components/card.md‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@ Pass raw SVG markup as `IconSvg`. It renders inside a `.doc-card-icon` container
3838

3939
Write the SVG with single-quoted attributes so it fits inside the double-quoted `IconSvg` value.
4040

41-
<Callout Variant="warning" Title="Icons belong in a preview fence or a .razor page">
42-
Raw SVG in an attribute works inside a `razor:preview` fence and in `.razor` files. An inline `Card` tag in page prose can't carry it : the prose tag scanner ends a tag at the first closing angle bracket, and HTML entities are not decoded. For a card grid with icons in prose, build it as a small Razor component and drop that in.
43-
</Callout>
41+
The same attribute works on a `Card` written straight into the page:
42+
43+
<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." />
44+
45+
Write the markup itself, not HTML entities : attribute values are not decoded.
4446

4547
## With child content
4648

@@ -71,7 +73,7 @@ Bring your own component library, register it in one line with <code>RegisterCom
7173
<TypeRow Name="Title" Type="string?" Default="—" Description="Optional title, rendered as .doc-card-title." />
7274
<TypeRow Name="Description" Type="string?" Default="—" Description="Optional short description below the title." />
7375
<TypeRow Name="Href" Type="string?" Default="—" Description="When set, the whole card becomes a link pointing here." />
74-
<TypeRow Name="IconSvg" Type="string?" Default="—" Description="Raw SVG markup rendered above the title. See the icon section above." />
76+
<TypeRow Name="IconSvg" Type="string?" Default="—" Description="Raw SVG markup rendered above the title. Use single quotes inside it." />
7577
<TypeRow Name="External" Type="bool" Default="false" Description="When true (and Href set), adds target='_blank' and rel='noopener'." />
7678
<TypeRow Name="ChildContent" Type="RenderFragment?" Default="—" Description="Rich body content, rendered below the description." />
7779
</TypeTable>

‎content/docs/components/code-group.md‎

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,31 +21,32 @@ dotnet add package ShellDocs.Components --prerelease
2121
<CodeTab Label="PackageReference">
2222

2323
```xml
24-
<PackageReference Include="ShellDocs.Components" Version="0.1.11-alpha" />
24+
<PackageReference Include="ShellDocs.Components" Version="0.1.12-alpha" />
2525
```
2626

2727
</CodeTab>
2828
</CodeGroup>
2929

3030
Write it as an inline tag in the page, with a fenced block in each tab. Leave a blank line between the tags and the fences:
3131

32-
<pre><code class="language-markdown">&lt;CodeGroup&gt;
33-
&lt;CodeTab Label="dotnet CLI"&gt;
32+
````markdown
33+
<CodeGroup>
34+
<CodeTab Label="dotnet CLI">
3435

35-
&#96;&#96;&#96;bash
36+
```bash
3637
dotnet add package ShellDocs.Components --prerelease
37-
&#96;&#96;&#96;
38+
```
3839

39-
&lt;/CodeTab&gt;
40-
&lt;CodeTab Label="PackageReference"&gt;
40+
</CodeTab>
41+
<CodeTab Label="PackageReference">
4142

42-
&#96;&#96;&#96;xml
43-
&lt;PackageReference Include="ShellDocs.Components" Version="0.1.11-alpha" /&gt;
44-
&#96;&#96;&#96;
43+
```xml
44+
<PackageReference Include="ShellDocs.Components" Version="0.1.12-alpha" />
45+
```
4546

46-
&lt;/CodeTab&gt;
47-
&lt;/CodeGroup&gt;
48-
</code></pre>
47+
</CodeTab>
48+
</CodeGroup>
49+
````
4950

5051
## Syncing tabs
5152

@@ -62,7 +63,7 @@ dotnet add package ShellDocs.Core --prerelease
6263
<CodeTab Label="PackageReference">
6364

6465
```xml
65-
<PackageReference Include="ShellDocs.Core" Version="0.1.11-alpha" />
66+
<PackageReference Include="ShellDocs.Core" Version="0.1.12-alpha" />
6667
```
6768

6869
</CodeTab>
@@ -79,7 +80,7 @@ dotnet add package ShellDocs.Markdown --prerelease
7980
<CodeTab Label="PackageReference">
8081

8182
```xml
82-
<PackageReference Include="ShellDocs.Markdown" Version="0.1.11-alpha" />
83+
<PackageReference Include="ShellDocs.Markdown" Version="0.1.12-alpha" />
8384
```
8485

8586
</CodeTab>

‎content/docs/components/component-preview.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ A `razor:preview` fence reads better in the page source and keeps your formattin
2323
## Fence or tag
2424

2525
<TypeTable>
26-
<TypeRow Name="Code tab, fence" Type="fence" Description="Shows the fence body exactly as written, including indentation and comments." />
27-
<TypeRow Name="Code tab, tag" Type="tag" Description="Rebuilt from the component name, the attributes in alphabetical order, and the body." />
26+
<TypeRow Name="Code tab" Type="fence" Description="Shows the fence body exactly as written, including indentation and comments." />
27+
<TypeRow Name="Code tab" Type="tag" Description="Rebuilt from the component name, the attributes in alphabetical order, and the body." />
2828
<TypeRow Name="Several components" Type="fence" Description="A fence can hold sibling tags and wrapper elements." />
2929
<TypeRow Name="One component" Type="tag" Description="A tag previews exactly one component." />
3030
</TypeTable>

‎content/docs/components/preview-frame.md‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,13 @@ A frame centres its example by default. Two other layouts cover examples that do
4242

4343
On a fence, add the layout after the language:
4444

45-
<pre><code class="language-markdown">&#96;&#96;&#96;razor:preview stretch
46-
&lt;TypeTable&gt;
47-
&lt;TypeRow Name="Title" Type="string?" Description="Optional title." /&gt;
48-
&lt;/TypeTable&gt;
49-
&#96;&#96;&#96;
50-
</code></pre>
45+
````markdown
46+
```razor:preview stretch
47+
<TypeTable>
48+
<TypeRow Name="Title" Type="string?" Description="Optional title." />
49+
</TypeTable>
50+
```
51+
````
5152

5253
```razor:preview stretch
5354
<TypeTable>

‎content/docs/components/steps.md‎

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,25 +68,26 @@ Callouts, cards, code groups : anything you can use in top-level prose also work
6868

6969
The source for that block:
7070

71-
<pre><code class="language-markdown">&lt;Steps&gt;
72-
&lt;Step Title="Add the package"&gt;
71+
````markdown
72+
<Steps>
73+
<Step Title="Add the package">
7374

74-
&#96;&#96;&#96;bash
75+
```bash
7576
dotnet add package ShellDocs.Components --prerelease
76-
&#96;&#96;&#96;
77+
```
7778

78-
&lt;/Step&gt;
79-
&lt;Step Title="Register the services"&gt;
79+
</Step>
80+
<Step Title="Register the services">
8081

81-
Add a line to &#96;Program.cs&#96;:
82+
Add a line to `Program.cs`:
8283

83-
&#96;&#96;&#96;csharp
84+
```csharp
8485
builder.Services.AddShellDocs();
85-
&#96;&#96;&#96;
86+
```
8687

87-
&lt;/Step&gt;
88-
&lt;/Steps&gt;
89-
</code></pre>
88+
</Step>
89+
</Steps>
90+
````
9091

9192
Use the inline form for real walk-throughs. Keep `razor:preview` for showing the component itself : fence bodies are Razor, so markdown inside them renders literally.
9293

0 commit comments

Comments
 (0)