Problem
Leadtype has a strong internal pipeline, but users who need custom behavior currently have to work around it or fork pieces. We need extension points that preserve the pipeline's stability.
Proposal
Add typed transformer lifecycle hooks around parsing, markdown flattening, search indexing, and LLM artifact generation.
Example:
export default defineDocsConfig({
transformers: [
{
name: "api-area-metadata",
afterFrontmatter(page) {
return {
...page,
frontmatter: {
...page.frontmatter,
apiArea: inferApiArea(page.filePath),
},
};
},
beforeSearchChunk(chunk) {
return boostApiSymbols(chunk);
},
},
],
});
Potential hooks:
beforeParse
afterFrontmatter
afterMdxAst
afterFlattenMarkdown
beforeSearchIndex
beforeLlmsTxt
beforeAgentsMd
Core Behavior
- Hooks operate on Leadtype pipeline objects, not framework request/response objects.
- Hooks run in deterministic order.
- Hook errors include transformer name and source path.
- Existing remark plugin behavior remains compatible.
Framework Integration Notes
Docs should show framework-specific consumption patterns:
- SvelteKit: derive route/layout metadata for
load.
- Nuxt: enrich pages for navigation/sidebar fields.
- Astro: align generated metadata with Content Collections conventions.
- Next/Fumadocs: derive sidebar/search metadata.
Acceptance Criteria
Problem
Leadtype has a strong internal pipeline, but users who need custom behavior currently have to work around it or fork pieces. We need extension points that preserve the pipeline's stability.
Proposal
Add typed transformer lifecycle hooks around parsing, markdown flattening, search indexing, and LLM artifact generation.
Example:
Potential hooks:
beforeParseafterFrontmatterafterMdxAstafterFlattenMarkdownbeforeSearchIndexbeforeLlmsTxtbeforeAgentsMdCore Behavior
Framework Integration Notes
Docs should show framework-specific consumption patterns:
load.Acceptance Criteria