RazorDocs Search
API Reference

ViewComponents

Type

SidebarViewComponent

Source

A view component that renders the sidebar navigation for public documentation sections.

Remarks

The component returns a DocSidebarViewModel whose DocSidebarViewModel.Sections contain normalized public section links and whose DocSidebarViewModel.HarvestHealth is populated only when harvest health chrome is visible for the configured options and host environment.

Method

InvokeAsync

Task<IViewComponentResult> InvokeAsync() Source

Retrieves the normalized public sections and optional harvest health chrome, then shapes them into the sidebar display model.

Returns

A view result containing the section-first sidebar view model and optional harvest health chrome.

Remarks

InvokeAsync returns a DocSidebarViewModel whose sections come from normalized public section snapshots and whose DocSidebarViewModel.HarvestHealth value is resolved by ResolveHarvestHealthAsync. Harvest health is controlled by RazorDocsHarvestHealthVisibility and may be null when chrome is hidden. When present, it contains a DocSidebarHarvestHealthViewModel.Status, DocSidebarHarvestHealthViewModel.Ok, and an optional DocSidebarHarvestHealthViewModel.Href. The href is omitted when chrome is visible but health routes are not exposed. Health resolution uses DocAggregator.GetHarvestHealthAsync(CancellationToken), links with DocsUrlBuilder.BuildHealthUrl, and observes the current request's aborted token.

Method

ResolveHarvestHealthAsync

Task<DocSidebarHarvestHealthViewModel?> ResolveHarvestHealthAsync() Source

Resolves the optional harvest health chrome view model for the current sidebar request.

Returns

The sidebar harvest health view model, or null when chrome is hidden.

Remarks

Returns null when RazorDocsHarvestHealthVisibility.ShouldShowChrome(RazorDocsOptions, IHostEnvironment) hides chrome. Otherwise it reads the current harvest snapshot through DocAggregator.GetHarvestHealthAsync(CancellationToken), maps the status and verification result, and supplies an href from DocsUrlBuilder.BuildHealthUrl only when RazorDocsHarvestHealthVisibility.AreRoutesExposed(RazorDocsOptions, IHostEnvironment) exposes the operator route. The aggregation wait respects HttpContext.RequestAborted when a view context is available.

Type

SidebarDisplayHelper

Source

Normalizes RazorDocs sidebar labels, grouping, and namespace display names.

Remarks

SidebarDisplayHelper treats the authored Namespaces route family specially so API reference pages stay grouped together. Path inputs are trimmed, slash-normalized, and allowed to be empty only where the method explicitly documents the fallback.

Method

GetGroupName

2 overloads
string GetGroupName(DocNode node) Source

Gets the sidebar group for a documentation node, honoring explicit metadata except for namespace pages.

Parameters

  • nodeThe documentation node to classify.

Returns

The normalized group name, Namespaces for namespace pages, or a path-derived fallback.

string GetGroupName(string path) Source

Gets the sidebar group implied by a source path.

Parameters

  • pathA source or docs path. Directory separators and leading or trailing slashes are normalized.

Returns

Namespaces for namespace paths, General for root files, or the containing directory.

Method

NormalizeGroupName

string? NormalizeGroupName(string? groupName) Source

Trims an authored group name and converts blank values to null.

Parameters

  • groupNameThe authored group name.

Returns

A trimmed group name, or null when no meaningful group was authored.

Method

IsTypeAnchorNode

bool IsTypeAnchorNode(DocNode node) Source

Determines whether a node represents a generated type-anchor entry below a parent API page.

Parameters

  • nodeThe node to inspect.

Returns

true when the node has a parent, no body content, and a fragment path.

Method

GetFullNamespaceName

string GetFullNamespaceName(DocNode node) Source

Gets the full namespace represented by a namespace documentation node.

Parameters

  • nodeA node from the Namespaces route family or a fallback titled node.

Returns

The namespace path after Namespaces/, an empty string for the root, or the node title fallback.

Method

GetNamespaceFamily

string GetNamespaceFamily(string fullNamespace, IReadOnlyList<string> namespacePrefixes) Source

Gets the top-level namespace family after configured prefix simplification.

Parameters

  • fullNamespaceThe full namespace to simplify.
  • namespacePrefixesPrefixes that may be removed before family extraction.

Returns

The first simplified namespace segment, or the whole simplified value when it has no dot.

Method

GetNamespaceDisplayName

string GetNamespaceDisplayName(string fullNamespace, IReadOnlyList<string> namespacePrefixes) Source

Gets the display name for a namespace after removing its family segment.

Parameters

  • fullNamespaceThe full namespace to simplify.
  • namespacePrefixesPrefixes that may be removed before display extraction.

Returns

The namespace remainder after the family segment, or the simplified namespace when no remainder exists.

Method

SimplifyNamespace

string SimplifyNamespace(string fullNamespace, IReadOnlyList<string> namespacePrefixes) Source

Removes the first matching configured namespace prefix from a namespace.

Parameters

  • fullNamespaceThe namespace to simplify. Blank values become Namespaces.
  • namespacePrefixesCandidate prefixes, with optional trailing dots.

Returns

The simplified namespace, the last prefix segment for exact prefix matches, or the original namespace.

Method

GetDerivedNamespacePrefixes

string[] GetDerivedNamespacePrefixes(IEnumerable<DocNode> docs) Source

Derives shared namespace prefixes from the root namespace pages in a docs set.

Parameters

  • docsThe harvested documentation nodes.

Returns

The shared prefix with and without trailing dot, or an empty array when no common prefix exists.

Method

GetLastNamespaceSegment

string GetLastNamespaceSegment(string namespaceValue) Source

Gets the last segment of a namespace value.

Parameters

  • namespaceValueA dot-delimited namespace value.

Returns

The segment after the last dot, or the original value when no dot exists.

Type

DocSectionDisplayBuilder

Source

Shapes public-section snapshots into the grouped link structures used by section pages and the shared sidebar.

Method

BuildGroups

IReadOnlyList<DocSectionGroupViewModel> BuildGroups(DocSectionSnapshot snapshot, string? currentHref = null, IReadOnlyList<string>? namespacePrefixes = null, string docsRootPath = "/docs") Source

Builds grouped section links for one public section snapshot.

Parameters

  • snapshotThe public-section snapshot to group for display.
  • currentHrefThe current docs href, if known. When provided, matching links are marked current for accessibility and styling.
  • namespacePrefixesOptional namespace prefixes used to shorten API-reference labels and family headings. When omitted, API-reference groups derive prefixes from the visible pages in snapshot.
  • docsRootPathThe app-relative docs root path used to build canonical links for the current surface.

Returns

The grouped link model for the supplied section snapshot.

Remarks

Editorial sections stay flat and task-oriented, while DocPublicSection.ApiReference delegates to the namespace-aware grouping path so API reference content stays organized by family. API-reference groups intentionally omit generated type-anchor children from these global navigation models, and deeper namespace children are nested under their nearest useful parent so repeated namespace prefixes do not dominate the primary sidebar. Readers reach type and member anchors from the namespace page's local outline, source links, or search instead of loading every symbol into the primary sidebar.