Contents

Plugin Manager API

The PluginManager class in Uchū Docs namespace is responsible for managing plugin registration and execution throughout the documentation lifecycle.


Plugin Manager Diagram

classDiagram class PluginManager { - PluginInterface[] plugins + registerPlugin(PluginInterface): self + getPluginsByType(string): PluginInterface[] + modifyContent(string, string): string + executePreRenderPlugins(string): void + executePostRenderPlugins(string, string): void } class PluginInterface { + getPriority(): int } class ContentModifierPluginInterface { + modifyContent(string, string): string } class PreRenderPluginInterface { + preRender(string): void } class PostRenderPluginInterface { + postRender(string, string): void } PluginManager --> PluginInterface : uses PluginManager --> ContentModifierPluginInterface : filters PluginManager --> PreRenderPluginInterface : filters PluginManager --> PostRenderPluginInterface : filters ContentModifierPluginInterface ..|> PluginInterface PreRenderPluginInterface ..|> PluginInterface PostRenderPluginInterface ..|> PluginInterface

Interfaces Used


Constructor

__construct()

Initializes an empty plugin manager.

Public Methods

registerPlugin

registerPlugin(PluginInterface $plugin): self

Registers a new plugin and sorts all plugins by their priority.

getPluginsByType

getPluginsByType(string $interfaceType): array

Filters and returns plugins matching the specified interface type.

modifyContent

modifyContent(string $content, string $pageName): string

Passes content through all registered content modifier plugins.

executePreRenderPlugins

executePreRenderPlugins(string $pageName): void

Runs all pre-render plugin hooks.

executePostRenderPlugins

executePostRenderPlugins(string $pageName, string $renderedContent): void

Runs all post-render plugin hooks.

Example Usage

$pluginManager = new PluginManager();
$pluginManager->registerPlugin(new MyCustomPlugin());

$pluginManager->executePreRenderPlugins('getting_started');
$content = $pluginManager->modifyContent($markdownContent, 'getting_started');
$pluginManager->executePostRenderPlugins('getting_started', $htmlContent);
Join our Discord
Discord Community