'ai-ready:markdown'Type: (context: MarkdownContext) => void | Promise<void>
Called during HTML→Markdown conversion in the runtime middleware. Allows you to modify the markdown content before it's returned to the client.
Context:
interface MarkdownContext {
html: string // Original HTML content
markdown: string // Generated markdown (modify this)
route: string // Route being processed
title: string // Page title
description: string // Page description
isPrerender: boolean // Whether during prerendering
event: H3Event // H3 event object
}
Example: Add Footer
export default defineNitroPlugin((nitroApp) => {
nitroApp.hooks.hook('ai-ready:markdown', async (context) => {
// Add footer to all markdown
context.markdown += '\n\n---\n*Generated with mdream*'
})
})
'ai-ready:mdreamConfig'Type: (config: HTMLToMarkdownOptions) => void | Promise<void>
Called before HTML→Markdown conversion. Allows you to modify the mdream configuration options.
Example: Custom Plugin
export default defineNitroPlugin((nitroApp) => {
nitroApp.hooks.hook('ai-ready:mdreamConfig', async (config) => {
// Add custom mdream plugin
config.plugins = config.plugins || []
config.plugins.push(myCustomPlugin())
})
})