Skip to content

feat: content primitives : Callout, Card, Steps, FileTree, CodeGroup + stable razor:preview - #11

Merged
Shewart merged 7 commits into
mainfrom
feat/content-primitives
Jul 21, 2026
Merged

feat: content primitives : Callout, Card, Steps, FileTree, CodeGroup + stable razor:preview#11
Shewart merged 7 commits into
mainfrom
feat/content-primitives

Conversation

@Shewart

@Shewart Shewart commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Ships the six markdown-authorable content primitives fumadocs-style docs need, and stabilises the razor:preview block so nested-component previews stop rendering as literal HTML.

New primitives (auto-registered by AddShellDocs, so <Callout> / <Card> / etc. work in any .md file with zero wiring):

Component Purpose
<Callout Variant="info|warning|danger|tip"> Coloured info box with icon + title + prose
<Card Title Description Href IconSvg> Anchor-or-div card; auto <a> when Href is set
<CardGrid Columns="1|2|3"> Responsive grid wrapper for <Card> / <LinkCard>
<LinkCard Title Description Href> Horizontal arrow-decorated navigation card
<Steps> / <Step Title> CSS-counter numbered ordered list with a rail
<FileTree> / <FileTreeItem Name IsFolder Highlight Comment> Recursive project-layout diagram
<CodeGroup SyncKey> / <CodeTab Label> Tabbed code samples that sync across the page via a scoped CodeGroupSyncState

Preview infrastructure fixes — the tab UI in PreviewFrame was replaced with a shadcn-style stacked layout:

  • Preview always sits on top, code teaser (~8.5rem) below with a gradient fade + centered View Code button; Collapse and Copy buttons appear top-right on expand.
  • Both preview and code stay mounted for the lifetime of the frame — Blazor never dismounts the DynamicComponent, so component state survives, and Shiki's one-shot DOM mutation on the code element is never re-diffed. Kills the whole class of tab-switch bugs.
  • PreviewSlot now carries ChildContentRaw, extracted between the opening/closing tags of a razor:preview block. A shared SlotRenderer.FromMarkup helper recursively renders that raw markup as real nested DynamicComponents.
  • SlotRenderer.BuildParameters reflects on the target component type and coerces string attribute values to the declared [Parameter] type — IsFolder="true"bool true, Columns="2"int, Variant="info" → enum, all cached per-type via a PropertyInfo map. Fixes InvalidCastException on <FileTreeItem IsFolder="true">.
  • SlotRenderer.Dedent strips common leading whitespace before feeding nested markup back through Markdig — otherwise 4-space-indented children of <Steps> / <FileTree> were treated as indented code blocks and rendered as <pre> around placeholder divs.

Docs — added card.md, steps.md, filetree.md, code-group.md to the preview app; updated meta.json sidebar order.

Tests — renamed the local Callout test double to CustomWidget in AddShellDocsTests to avoid resolution collision with the newly auto-registered production Callout.

Shewart added 7 commits July 21, 2026 23:29
…oup, and FileTree with corresponding styles, enhancing content presentation and organization
…nd Steps, enhancing documentation structure and user navigation
…nt for auto-registered components in ShellDocs
…ntegrating SlotRenderer for parameter handling and removing unused code, enhancing maintainability and performance
…ponents in ServiceCollectionExtensions, improving component accessibility in markdown previews
…oved rendering of non-self-closing tags in markdown
…et, ensuring accurate component registration in TypeRegistry
@Shewart
Shewart merged commit 0f8e3fb into main Jul 21, 2026
1 check passed
@Shewart
Shewart deleted the feat/content-primitives branch July 21, 2026 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant