DevOpsWikiStrategy Class

Namespace
Kampute.DocToolkit
Assembly
  • Kampute.DocToolkit.dll

Definition

Provides an addressing strategy for organizing and addressing documentation pages hosted on an Azure DevOps Wiki.
public class DevOpsWikiStrategy : AddressingStrategy, ILanguageSpecific, IContextualAddressingStrategy
Inheritance
Implements

Remarks

The DevOpsWikiStrategy class provides a structured approach for organizing and resolving documentation pages hosted on an Azure DevOps Wiki. It translates code references into wiki-friendly URLs and file paths, ensuring compatibility with Azure DevOps' wiki structure.

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, accessible through URL fragments for efficient navigation while maintaining a clean wiki structure.

Content organization for topics follows a simple hierarchical structure based on parent-child relationships. Topic paths are constructed using encoded titles, with child topics nested under their parents to maintain a clean and navigable wiki structure.

Key features of the DevOpsWikiStrategy addressing strategy include:
  • Compatibility with Azure DevOps Wiki linking conventions
  • Namespace-then-type hierarchy for intuitive API documentation navigation
  • URL fragments for type members to maintain clean page structure
This strategy works well for teams that want to maintain their documentation directly within their Azure DevOps environment, providing seamless integration between code and narrative documentation that's easily accessible to all team members.

Thread Safety

Public instance members can be considered thread-safe if neither DevOpsWikiOptions.MainTopicId nor DevOpsWikiOptions.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

DevOpsWikiStrategy()Initializes a new instance of the DevOpsWikiStrategy class with default options.
DevOpsWikiStrategy(DevOpsWikiOptions)Initializes a new instance of the DevOpsWikiStrategy class with the specified options.

Properties

ApiPathGets the file path of the main API page.
GranularityGets the page granularity used for organizing documentation content.
LanguageGets the programming language formatter used for formatting member names.
MainPathGets the file path of the main documentation page.

Methods

EncodeWikiFragmentIdentifier(string)Encodes a string for use as a fragment identifier compatible with Azure DevOps Wiki heading fragments.
EncodeWikiPath(ReadOnlySpan<char>)Encodes special characters in the given title as per the Azure DevOps Wiki requirements for page titles.
GetNamespacePath(string)Retrieves the relative documentation path for the specified namespace.
GetTopicPath(ITopic)Retrieves the relative documentation path for the specified topic.
GetTypePath(IType)Retrieves the relative documentation path for the specified type.
IsAddressable(IMember)Determines whether the specified member can be addressed by this strategy.
TryResolveMemberAddress(IMember, out IResourceAddress)Attempts to resolve the address of the documentation content for the specified member.
TryResolveNamespaceAddress(string, out IResourceAddress)Attempts to resolve the address of the documentation content for the specified namespace.
TryResolveTopicAddress(ITopic, out IResourceAddress)Attempts to resolve the address for the documentation content of the specified topic.

Explicit Interface Implementations

IContextualAddressingStrategy.InitializeWithContext(IDocumentationContext)Binds the addressing strategy to the specified documentation context.

Extension Methods

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

See Also