RazorDocs Search

Services

Type

DocAggregator

Service responsible for aggregating documentation from multiple harvesters and caching the results.

Method

GetDocsAsync

Task<IEnumerable<DocNode>> GetDocsAsync(CancellationToken cancellationToken = default)

Retrieves all harvested documentation nodes sorted by their Path.

Parameters

  • cancellationTokenAn optional token to observe for cancellation requests.

Returns

An enumerable of all DocNode objects ordered by their Path.

Method

GetDocByPathAsync

Task<DocNode?> GetDocByPathAsync(string path, CancellationToken cancellationToken = default)

Retrieves a specific documentation node for the specified repository path.

Parameters

  • pathThe documentation path to look up.
  • cancellationTokenAn optional token to observe for cancellation requests.

Returns

The DocNode if found, or null if no node exists for the given path.

Method

GetCachedDocsAsync

Task<Dictionary<string, DocNode>> GetCachedDocsAsync(CancellationToken cancellationToken = default)

Retrieves harvested documentation nodes from the cache, harvesting and caching them if absent.

Parameters

  • cancellationTokenAn optional token to observe for cancellation requests.

Returns

A dictionary mapping each documentation Path to its corresponding sanitized DocNode. Returns an empty dictionary if no documents are available.

Remarks

When harvesting, each configured harvester is invoked; failures from individual harvesters are caught and logged. Contents are sanitized before being cached. If multiple nodes share the same Path, a warning is logged and the first occurrence is retained. The cache entry is created with a 5-minute absolute expiration.

Type

MarkdownHarvester

Harvester implementation that scans Markdown source files and converts them into documentation nodes.

Method

HarvestAsync

Task<IEnumerable<DocNode>> HarvestAsync(string rootPath, CancellationToken cancellationToken = default)

Harvests Markdown files under the specified root directory and converts each into a DocNode containing a display title, relative path, and generated HTML.

Parameters

  • rootPathThe root directory to search recursively for `.md` files.
  • cancellationTokenAn optional token to observe for cancellation requests.

Returns

A collection of DocNode objects representing each processed Markdown file, containing the display title, path relative to rootPath, and generated HTML.

Remarks

Skips files in excluded directories (for example "node_modules", "bin", "obj", and "Tests") and hidden dot-prefixed directories unless explicitly allowlisted. Dot-prefixed files are included. If a file's name is "README" (case-insensitive), its title is set to the parent directory name or "Home" for a repository root README. Files that fail to process are skipped and an error is logged.

Type

CSharpDocHarvester

Harvester implementation that scans C# source files for XML documentation comments.

Method

HarvestAsync

Task<IEnumerable<DocNode>> HarvestAsync(string rootPath, CancellationToken cancellationToken = default)

Collects XML documentation from C# source files under the specified root and produces DocNode entries containing titles, relative file paths with anchors, and HTML-formatted content.

Parameters

  • rootPathThe root directory to recursively scan for .cs files.
  • cancellationTokenAn optional token to observe for cancellation requests.

Returns

A collection of DocNode objects; each contains a title, a relative file path including a fragment anchor, and the extracted HTML documentation.

Remarks

Skips files in excluded directories (for example "node_modules", "bin", "obj", and "Tests") and hidden dot-prefixed directories unless explicitly allowlisted. Dot-prefixed files are included.

Method

GetMethodSignatureAndId

(string Signature, string Id) GetMethodSignatureAndId(MethodDeclarationSyntax method, string qualifiedTypeName)

Computes the method signature and safe ID for use in HTML content and stub nodes.

Parameters

  • methodThe method declaration syntax.
  • qualifiedTypeNameThe qualified name of the containing type.

Returns

A tuple containing the method signature and the safe ID.

Method

ExtractDoc

string? ExtractDoc(SyntaxNode node)

Extracts XML documentation from the leading trivia of a syntax node and converts it into HTML fragments.

Parameters

  • nodeThe syntax node whose leading XML documentation comments will be parsed.

Returns

The HTML string containing structured documentation sections, or null if no documentation is present or parsing fails.

Method

EnsureNamespaceHierarchy

void EnsureNamespaceHierarchy(IDictionary<string, NamespaceDocPage> namespacePages)

Ensures parent namespace pages and child links exist, then rebuilds namespacePages in place keyed by NamespaceDocPage.Path.

Method

GetQualifiedName

string GetQualifiedName(BaseTypeDeclarationSyntax node)

Builds the dot-delimited qualified name for a type or enum declaration, including enclosing types and namespaces.

Parameters

  • nodeThe type or enum declaration syntax node to compute the qualified name for.

Returns

The qualified name as a dot-delimited string containing nested type and namespace segments.