Nuxt AI Ready uses mdream to convert HTML pages to markdown during prerendering and runtime.
During nuxi generate or nuxi build --prerender:
/llms-full.toon (chunk-level) and /llms.toon (page-level).md routes// Chunking config (reference)
const chunks = htmlToMarkdownSplitChunksStream(html, {
headersToSplitOn: [TagIdMap.h1, TagIdMap.h2, TagIdMap.h3],
chunkSize: 256,
lengthFunction: estimateTokenCount,
})
Requests with .md extension or Accept: text/markdown header trigger on-the-fly conversion with cache headers.
curl https://example.com/about.md
curl -H "Accept: text/markdown" https://example.com/about
export default defineNuxtConfig({
aiReady: {
mdreamOptions: {
preset: 'minimal', // Use minimal preset
},
markdownCacheHeaders: {
maxAge: 3600, // Cache for 1 hour
swr: true, // Enable stale-while-revalidate
},
},
})
ai-ready:mdreamConfig// Dynamic config based on route
nitroApp.hooks.hook('ai-ready:mdreamConfig', (options) => {
if (options.origin?.includes('/blog/'))
options.ignoreElements = [...(options.ignoreElements || []), '.author-bio']
})
// Full docs: /docs/ai-ready/nitro-api/nitro-hooks#ai-ready-mdreamconfig
ai-ready:markdown// Post-process markdown output
nitroApp.hooks.hook('ai-ready:markdown', (context) => {
context.markdown = `---\ntitle: ${context.title}\n---\n\n${context.markdown}`
})
// Full docs: /docs/ai-ready/nitro-api/nitro-hooks#ai-ready-markdown