GitLabWikiStrategy Class

Namespace
Kampute.DocToolkit
Assembly
  • Kampute.DocToolkit.dll

Definition

Provides an addressing strategy for organizing and addressing documentation pages hosted on a GitLab Wiki.
public class GitLabWikiStrategy : MarkdownAddressingStrategy
Inheritance

Remarks

The GitLabWikiStrategy class provides a structured approach for organizing and resolving documentation pages hosted on a GitLab Wiki. It translates code references into wiki pages and heading anchors that follow GitLab's conventions.

The strategy organizes API documentation content into namespace and type pages. Namespaces receive dedicated pages, with types documented on separate pages nested under their namespaces. Type members such as methods and properties are documented on their declaring type's page, and are addressed by the anchor GitLab generates for their headings.

Content organization for topics follows a simple hierarchical structure based on parent-child relationships. Topic pages are named after their titles, with child topics nested under their parents.

GitLab serves the page at the path home as the front page of a wiki. When MarkdownAddressingOptions.MainTopicId is set, the page of the main topic is therefore placed at that path regardless of the topic's title, and all other pages are nested under it.

GitLab displays the file name of a page as its title, showing hyphens as spaces. Because page names cannot contain every character a title can, renderers can write the original title in the title field of the page's front matter, which GitLab displays instead of the file name.

Thread Safety

Public instance members can be considered thread-safe if neither MarkdownAddressingOptions.MainTopicId nor MarkdownAddressingOptions.ApiTopicId is set in the construction options of the instance. If either property is set, instance members are only thread-safe if the instance is fully initialized (that is, IContextualAddressingStrategy.InitializeWithContext(IDocumentationContext) has been called) before any other method is accessed, and there is no concurrent access during or before initialization.

The class is not thread-safe otherwise, because it contains a mutable context field and uses lazy initialization that depends on this field, without synchronization.

Constructors

GitLabWikiStrategy()Initializes a new instance of the GitLabWikiStrategy class with default options.
GitLabWikiStrategy(GitLabWikiOptions)Initializes a new instance of the GitLabWikiStrategy class with the specified options.

Methods

EncodePageName(string)Converts the specified title to the name of a page, as it appears in the file path and URL of the page.
EncodeWikiPath(ReadOnlySpan<char>)Converts the given title to a GitLab Wiki page name that is valid as a file name and as a URL path segment.
GetTopicPath(ITopic)Retrieves the relative documentation path for the specified topic.

Extension Methods

TryResolveAddressByCodeReference(this IDocumentAddressingStrategy, string, out IResourceAddress)Attempts to resolve the address of the documentation content for the specified code reference.

See Also