/*
RFC-0208: block text extraction types and registry. Declarative extractors map block-based page content into semantic text for markdown twins.
- Do not contain extractor implementations — those live in block-extractors/.
- RFC-0208: introduced block extraction layer for comprehensive markdown twins.
*/
export interface ExtractionContext {
pageId: string;
lang: string;
siteUrl: string;
}
export interface ExtractedBlockContent {
heading?: string;
lead?: string;
body?: string;
items?: Array<{ title: string; description?: string }>;
sourceBlockId?: string;
}
export interface BlockTextExtractor {
blockType: string;
extract(props: T, ctx: ExtractionContext): ExtractedBlockContent;
}
export class BlockExtractorRegistry {
private extractors = new Map();
register(extractor: BlockTextExtractor): void {
this.extractors.set(extractor.blockType, extractor as BlockTextExtractor);
}
get(blockType: string): BlockTextExtractor | undefined {
return this.extractors.get(blockType);
}
has(blockType: string): boolean {
return this.extractors.has(blockType);
}
listTypes(): string[] {
return Array.from(this.extractors.keys());
}
}
export const BLOCK_EXTRACTORS = new BlockExtractorRegistry();