/** * Base Plugin Class * * Abstract base class for diagram plugins. * Defines the plugin interface and core rendering logic. */ import type { ASTNode, PluginRenderer, UnifiedRenderResult } from '../types/index'; export declare class BasePlugin { type: string; /** * @param type - Plugin type identifier (e.g., 'mermaid', 'vega') */ constructor(type: string); /** * Get AST node selectors for remark visit * @returns Array of node types to visit (e.g., ['code'], ['code', 'image']) */ get nodeSelector(): string[]; /** * Get language identifier for code blocks * @returns Language identifier or null for non-code nodes */ get language(): string | null; /** * Extract content from AST node * Plugins override this to implement their own node matching logic * @param node - AST node * @returns Extracted content or null if not applicable */ extractContent(node: ASTNode): string | null; /** * Create async task data for rendering * @param content - Extracted content * @returns Task data with code and any extra parameters */ createTaskData(content: string): Record; /** * Get extra rendering parameters * @returns Extra parameters for renderer */ getRenderParams(): Record; /** * Check if this plugin uses inline rendering * @returns True for inline (span), false for block (div) */ isInline(): boolean; /** * Check if extracted content is a URL that needs fetching * @param content - Extracted content * @returns True if content is a URL */ isUrl(content: string): boolean; /** * Fetch content from URL * @param url - URL to fetch * @returns Fetched content */ fetchContent(url: string): Promise; /** * Render content to unified intermediate format * This is the core rendering method that returns a format-agnostic result * @param renderer - Renderer instance * @param content - Content to render * @returns Unified render result */ renderToCommon(renderer: PluginRenderer | null, content: string): Promise; }