Repository navigation
feat: generic components, redirects and frontmatter page titles - #30
Merged
Merged
Conversation
…nentPreview RegisterComponentsFromAssembly skipped generic definitions, so <BarChart TItem="…">, data tables and typed selects couldn't be used from markdown. Generic components now register under their bare name and SlotRenderer.Component closes them per use from attributes named after the type parameters, as Razor does. Type arguments accept C# spellings (aliases, T?, T[], List<T>, simple or full names). Without one, object is used when the constraints allow it, with a warning; otherwise an inline .shelldocs-render-error replaces the component instead of breaking the page. A non-generic component with the same name keeps the tag, and AutoTypeTable lists type parameters.
Folder URLs and version roots go to their first page (/docs prefers unversioned pages, then the latest version), unversioned URLs that exist in the latest version go there, and AddRedirect adds segment-aware prefix rules (301; computed ones are 302). Middleware added through an IStartupFilter answers them before routing, so dotted version roots that {*Path:nonfile} can't match work too, and serves /_shelldocs/redirects.json, which shelldocs build writes out as static redirect pages. EnableRedirects = false opts out. ShellDocs.Components now references the ASP.NET Core shared framework for the middleware; it already read content from disk.
A csproj with <Content Update="content/**/*.md"> publishes meta.json but no markdown, and build only mirrored content/ when the folder was missing entirely, so every page prerendered as "Page not found". Build now merges in any source content file publish didn't copy. The example project had exactly this csproj; it now uses Content Include like the init scaffold.
ShellDocsOptions.RenderPageTitle renders frontmatter title as the page heading and description as a lead paragraph when the markdown body doesn't start with its own # heading, so pages don't need a manual H1. Off by default.
CHANGELOG Unreleased entries; README sections on redirects, generic components and RenderPageTitle; ARCHITECTURE on DocsRedirects, the middleware, generic closing and the build steps; installation and markdown-syntax pages, with a generic ValueBadge example component.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes out the ShellDocs backlog from building the ShellUI docs.
Added
Generic components in markdown. Generic components register under their bare name.
razor:preview, inline tags and<ComponentPreview>close them from a type-parameter attribute, as Razor does (<BarChart TItem="SalesRow" />).T?,T[],List<T>, simple or full names.objectwhen the constraints allow it, with a warning. Otherwise it renders an inline error.<AutoTypeTable>lists type parameters.Redirects. URLs that aren't pages are redirected:
o.AddRedirect(from, to, permanent)adds segment-aware prefix rules.An
IStartupFilteradds middleware that answers before routing, so dotted version roots work. It sends 302 for computed redirects and 301 for rules.shelldocs buildwrites the same redirects as static redirect pages.o.EnableRedirects = falseopts out.o.RenderPageTitle. Renders the frontmatter title and description as the page header when the body has no# Heading. Off by default.Changed
ShellDocs.Componentsreferences the ASP.NET Core shared framework, for the middleware, instead of theComponents.Webpackage. It already read content from disk.Fixed
shelldocs buildprerendered "Page not found" pages when publish copiedmeta.jsonbut not the.mdfiles. Build now fills in missing content files, and the example csproj is fixed.Testing
dotnet build: 0 warnings.dotnet test: 303 passing.GenericComponentTests,RedirectTests,PageTitleTests.shelldocs buildwrote 25 pages, none "Page not found", and 14 redirect pages.