Interface
public interface IPluginContext
Namespace: Moka.Docs.Plugins
Provides plugins with access to host services, configuration, and logging.
Properties
| Name | Description |
|---|---|
Options abstract |
Plugin-specific options from the plugins[].options section of mokadocs.yaml. |
SiteConfig abstract |
The current site configuration. |
Options
IReadOnlyDictionary<string, object> IPluginContext.Options { get; }
Plugin-specific options from the plugins[].options section of mokadocs.yaml.
SiteConfig
SiteConfig IPluginContext.SiteConfig { get; }
The current site configuration.
Methods
| Name | Description |
|---|---|
GetService() abstract |
Resolves a service from the host DI container. |
LogError(string message) abstract |
Logs an error message from the plugin. |
LogInfo(string message) abstract |
Logs an informational message from the plugin. |
LogWarning(string message) abstract |
Logs a warning message from the plugin. |
GetService()
T? IPluginContext.GetService<T>()
Resolves a service from the host DI container.
Returns: The resolved service, or null if not registered.
LogError(string message)
void IPluginContext.LogError(string message)
Logs an error message from the plugin.
Parameters
| Name | Type | Description |
|---|---|---|
message | string | The error message. |
LogInfo(string message)
void IPluginContext.LogInfo(string message)
Logs an informational message from the plugin.
Parameters
| Name | Type | Description |
|---|---|---|
message | string | The log message. |
LogWarning(string message)
void IPluginContext.LogWarning(string message)
Logs a warning message from the plugin.
Parameters
| Name | Type | Description |
|---|---|---|
message | string | The warning message. |
Type Relationships
classDiagram
style IPluginContext fill:#f9f,stroke:#333,stroke-width:2px
PluginContext ..|> IPluginContext : implements
View Source
/// <summary>
/// Provides plugins with access to host services, configuration, and logging.
/// </summary>
public interface IPluginContext
{
/// <summary>
/// The current site configuration.
/// </summary>
SiteConfig SiteConfig { get; }
/// <summary>
/// Plugin-specific options from the <c>plugins[].options</c> section of mokadocs.yaml.
/// </summary>
IReadOnlyDictionary<string, object> Options { get; }
/// <summary>
/// Resolves a service from the host DI container.
/// </summary>
/// <typeparam name = "T">The service type to resolve.</typeparam>
/// <returns>The resolved service, or <c>null</c> if not registered.</returns>
T? GetService<T>()
where T : class;
/// <summary>
/// Logs an informational message from the plugin.
/// </summary>
/// <param name = "message">The log message.</param>
void LogInfo(string message);
/// <summary>
/// Logs a warning message from the plugin.
/// </summary>
/// <param name = "message">The warning message.</param>
void LogWarning(string message);
/// <summary>
/// Logs an error message from the plugin.
/// </summary>
/// <param name = "message">The error message.</param>
void LogError(string message);
}