DocFormatProvider Class

Namespace
Kampute.DocToolkit.Formatters
Assembly
  • Kampute.DocToolkit.dll

Definition

Provides methods for registering and retrieving documentation formatters based on file extensions.
public static class DocFormatProvider
Inheritance

Remarks

The DocFormatProvider class serves as a central registry for documentation formatters, allowing the system to dynamically select appropriate formatters based on file extensions.

This class:
  • Manages associations between file extensions and formatter implementations
  • Provides factory methods to create formatters on demand
  • Supports registration of custom formatters for specific file types
  • Allows for overriding default formatters with custom implementations
The system comes pre-configured with formatters for common documentation formats (HTML and Markdown), but applications can register additional formatters or replace the built-in ones as needed.

Thread Safety

Public static members of the type are guaranteed to be thread-safe.

Methods

GetFormatterByExtension(string)Gets a documentation formatter based on the specified file extension.
GetRequiredFormatterByExtension(string)Gets a documentation formatter based on the specified file extension or throws an exception if no formatter is found.
IsRegistered(string)Determines whether a documentation formatter is registered for the specified file extension.
Register<TFormatter>(Func<string, TFormatter>, IEnumerable<string>)Registers a documentation formatter for the specified file extensions with the specified factory delegate.
Unregister<TFormatter>()Unregisters a documentation formatter for the associated file extensions.
Unregister(string)Unregisters a documentation formatter for the specified file extension.

See Also