nuxt-ai-ready 2.5.3 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -12
- package/dist/chunks/agent-skills.mjs +35 -12
- package/dist/chunks/prerender.mjs +35 -24
- package/dist/cli.mjs +5 -2
- package/dist/module.d.mts +4 -0
- package/dist/module.json +2 -2
- package/dist/module.mjs +8 -4
- package/dist/runtime/app/index.d.ts +3 -0
- package/dist/runtime/app/index.js +2 -0
- package/dist/runtime/cache-control.d.ts +2 -0
- package/dist/runtime/cache-control.js +11 -0
- package/dist/runtime/llms-txt-utils.js +1 -1
- package/dist/runtime/server/db/context.d.ts +13 -0
- package/dist/runtime/server/db/drizzle/client.d.ts +6 -7
- package/dist/runtime/server/db/drizzle/client.js +13 -2
- package/dist/runtime/server/db/drizzle/providers/bun.d.ts +2 -2
- package/dist/runtime/server/db/drizzle/providers/bun.js +2 -2
- package/dist/runtime/server/db/drizzle/providers/d1.d.ts +2 -2
- package/dist/runtime/server/db/drizzle/providers/d1.js +3 -2
- package/dist/runtime/server/db/drizzle/providers/libsql.d.ts +2 -2
- package/dist/runtime/server/db/drizzle/providers/libsql.js +2 -2
- package/dist/runtime/server/db/drizzle/providers/neon.d.ts +2 -2
- package/dist/runtime/server/db/drizzle/providers/neon.js +2 -2
- package/dist/runtime/server/db/drizzle/providers/node-sqlite.d.ts +2 -2
- package/dist/runtime/server/db/drizzle/providers/node-sqlite.js +2 -2
- package/dist/runtime/server/db/drizzle/providers/postgres.d.ts +2 -2
- package/dist/runtime/server/db/drizzle/providers/postgres.js +2 -2
- package/dist/runtime/server/db/drizzle/queries.d.ts +27 -27
- package/dist/runtime/server/db/drizzle/queries.js +6 -5
- package/dist/runtime/server/db/drizzle/raw.d.ts +2 -6
- package/dist/runtime/server/db/index.d.ts +1 -1
- package/dist/runtime/server/db/index.js +1 -1
- package/dist/runtime/server/db/queries.d.ts +36 -36
- package/dist/runtime/server/db/queries.js +8 -9
- package/dist/runtime/server/db/seed.d.ts +2 -2
- package/dist/runtime/server/db/seed.js +4 -3
- package/dist/runtime/server/db/shared.d.ts +8 -0
- package/dist/runtime/server/db/shared.js +8 -2
- package/dist/runtime/server/index.d.ts +2 -0
- package/dist/runtime/server/index.js +17 -0
- package/dist/runtime/server/mcp/cache-key.js +4 -0
- package/dist/runtime/server/mcp/tools/get-page-markdown.js +3 -2
- package/dist/runtime/server/mcp/tools/list-pages.js +3 -2
- package/dist/runtime/server/mcp/tools/search-pages.js +3 -2
- package/dist/runtime/server/middleware/markdown.prerender.js +1 -1
- package/dist/runtime/server/plugins/db-lifecycle-nitro3.d.ts +2 -0
- package/dist/runtime/server/plugins/db-lifecycle-nitro3.js +16 -0
- package/dist/runtime/server/plugins/html-capture.prerender.js +6 -4
- package/dist/runtime/server/plugins/link-header-nitro3.d.ts +2 -0
- package/dist/runtime/server/plugins/link-header-nitro3.js +20 -0
- package/dist/runtime/server/plugins/link-header.d.ts +6 -0
- package/dist/runtime/server/plugins/link-header.js +7 -11
- package/dist/runtime/server/plugins/markdown-negotiation.js +8 -1
- package/dist/runtime/server/plugins/sitemap-seeder.js +3 -3
- package/dist/runtime/server/routes/agent-skills-artifact.d.ts +1 -1
- package/dist/runtime/server/routes/agent-skills-artifact.js +10 -10
- package/dist/runtime/server/routes/agent-skills-index.d.ts +1 -1
- package/dist/runtime/server/routes/agent-skills-index.js +7 -6
- package/dist/runtime/server/routes/ai-catalog.d.ts +2 -1
- package/dist/runtime/server/routes/ai-catalog.js +7 -8
- package/dist/runtime/server/routes/api-catalog.d.ts +3 -1
- package/dist/runtime/server/routes/api-catalog.js +12 -12
- package/dist/runtime/server/routes/llms-full.txt.get.js +1 -1
- package/dist/runtime/server/routes/mcp-server-card.d.ts +1 -1
- package/dist/runtime/server/routes/mcp-server-card.js +7 -8
- package/dist/runtime/server/utils/checkStale.d.ts +2 -2
- package/dist/runtime/server/utils/cloudflare-prerendered.d.ts +3 -0
- package/dist/runtime/server/utils/cloudflare-prerendered.js +23 -0
- package/dist/runtime/server/utils/cloudflare.d.ts +5 -5
- package/dist/runtime/server/utils/cloudflare.js +31 -7
- package/dist/runtime/server/utils/content-negotiation.d.ts +5 -3
- package/dist/runtime/server/utils/content-negotiation.js +8 -7
- package/dist/runtime/server/utils/context.d.ts +3 -3
- package/dist/runtime/server/utils/context.js +1 -1
- package/dist/runtime/server/utils/discovery-response.d.ts +2 -0
- package/dist/runtime/server/utils/link-header.d.ts +5 -3
- package/dist/runtime/server/utils/link-header.js +26 -2
- package/dist/runtime/server/utils/markdown-request.d.ts +4 -3
- package/dist/runtime/server/utils/markdown-request.js +15 -13
- package/dist/runtime/server/utils/negotiation-decision.d.ts +4 -0
- package/dist/runtime/server/utils/negotiation-decision.js +6 -5
- package/dist/runtime/server/utils/negotiation-response.js +47 -22
- package/dist/runtime/server/utils/prerender-html.d.ts +2 -1
- package/dist/runtime/server/utils/prerender-html.js +3 -1
- package/dist/runtime/types.d.ts +15 -7
- package/dist/shared/nuxt-ai-ready.B3hAuOLQ.mjs +29 -0
- package/dist/shared/{nuxt-ai-ready.CLSWou20.mjs → nuxt-ai-ready.C34F0LJo.mjs} +560 -219
- package/package.json +86 -20
- package/skills/nuxt-ai-ready/SKILL.md +26 -12
- package/skills/nuxt-ai-ready/references/runtime-indexing.md +7 -6
- package/dist/runtime/server/db/drizzle/providers/sqlite.d.ts +0 -8
- package/dist/runtime/server/db/drizzle/providers/sqlite.js +0 -15
- package/node_modules/@mdream/js/LICENSE.md +0 -9
- package/node_modules/@mdream/js/README.md +0 -792
- package/node_modules/@mdream/js/bin/mdream.mjs +0 -2
- package/node_modules/@mdream/js/dist/_chunks/const.mjs +0 -134
- package/node_modules/@mdream/js/dist/_chunks/index.d.mts +0 -9
- package/node_modules/@mdream/js/dist/_chunks/markdown-processor.mjs +0 -1968
- package/node_modules/@mdream/js/dist/_chunks/minimal.d.mts +0 -6
- package/node_modules/@mdream/js/dist/_chunks/parse.mjs +0 -2756
- package/node_modules/@mdream/js/dist/_chunks/plugins.mjs +0 -725
- package/node_modules/@mdream/js/dist/_chunks/resolve-plugins.mjs +0 -44
- package/node_modules/@mdream/js/dist/_chunks/stream.mjs +0 -37
- package/node_modules/@mdream/js/dist/_chunks/types.d.mts +0 -473
- package/node_modules/@mdream/js/dist/cli.d.mts +0 -1
- package/node_modules/@mdream/js/dist/cli.mjs +0 -32
- package/node_modules/@mdream/js/dist/core.d.mts +0 -15
- package/node_modules/@mdream/js/dist/core.mjs +0 -28
- package/node_modules/@mdream/js/dist/index.d.mts +0 -4
- package/node_modules/@mdream/js/dist/index.mjs +0 -58
- package/node_modules/@mdream/js/dist/llms-txt.d.mts +0 -86
- package/node_modules/@mdream/js/dist/llms-txt.mjs +0 -308
- package/node_modules/@mdream/js/dist/negotiate.d.mts +0 -35
- package/node_modules/@mdream/js/dist/negotiate.mjs +0 -121
- package/node_modules/@mdream/js/dist/parse.d.mts +0 -90
- package/node_modules/@mdream/js/dist/parse.mjs +0 -2
- package/node_modules/@mdream/js/dist/plugins.d.mts +0 -85
- package/node_modules/@mdream/js/dist/plugins.mjs +0 -2
- package/node_modules/@mdream/js/dist/preset/minimal.d.mts +0 -2
- package/node_modules/@mdream/js/dist/preset/minimal.mjs +0 -33
- package/node_modules/@mdream/js/dist/splitter.d.mts +0 -18
- package/node_modules/@mdream/js/dist/splitter.mjs +0 -194
- package/node_modules/@mdream/js/package.json +0 -103
- package/node_modules/cac/LICENSE +0 -21
- package/node_modules/cac/README.md +0 -492
- package/node_modules/cac/dist/index.d.ts +0 -196
- package/node_modules/cac/dist/index.js +0 -638
- package/node_modules/cac/package.json +0 -72
- package/node_modules/mdream/LICENSE.md +0 -9
- package/node_modules/mdream/README.md +0 -1091
- package/node_modules/mdream/bin/mdream.mjs +0 -46
- package/node_modules/mdream/dist/browser.d.mts +0 -105
- package/node_modules/mdream/dist/browser.mjs +0 -262
- package/node_modules/mdream/dist/edge.d.mts +0 -100
- package/node_modules/mdream/dist/edge.mjs +0 -250
- package/node_modules/mdream/dist/iife.js +0 -605
- package/node_modules/mdream/dist/index.d.mts +0 -89
- package/node_modules/mdream/dist/index.mjs +0 -184
- package/node_modules/mdream/dist/wasm.d.mts +0 -100
- package/node_modules/mdream/dist/wasm.mjs +0 -140
- package/node_modules/mdream/dist/worker.d.mts +0 -101
- package/node_modules/mdream/dist/worker.mjs +0 -217
- package/node_modules/mdream/napi/index.d.mts +0 -127
- package/node_modules/mdream/napi/index.d.ts +0 -127
- package/node_modules/mdream/napi/index.mjs +0 -725
- package/node_modules/mdream/napi/rust.android-arm-eabi.node +0 -0
- package/node_modules/mdream/napi/rust.android-arm64.node +0 -0
- package/node_modules/mdream/napi/rust.darwin-arm64.node +0 -0
- package/node_modules/mdream/napi/rust.darwin-x64.node +0 -0
- package/node_modules/mdream/napi/rust.freebsd-x64.node +0 -0
- package/node_modules/mdream/napi/rust.linux-arm-gnueabihf.node +0 -0
- package/node_modules/mdream/napi/rust.linux-arm64-gnu.node +0 -0
- package/node_modules/mdream/napi/rust.linux-arm64-musl.node +0 -0
- package/node_modules/mdream/napi/rust.linux-x64-gnu.node +0 -0
- package/node_modules/mdream/napi/rust.linux-x64-musl.node +0 -0
- package/node_modules/mdream/napi/rust.wasi.cjs +0 -2144
- package/node_modules/mdream/napi/rust.wasm32-wasi.wasm +0 -0
- package/node_modules/mdream/napi/rust.win32-arm64-msvc.node +0 -0
- package/node_modules/mdream/napi/rust.win32-x64-msvc.node +0 -0
- package/node_modules/mdream/node_modules/@emnapi/core/LICENSE +0 -21
- package/node_modules/mdream/node_modules/@emnapi/core/README.md +0 -1
- package/node_modules/mdream/node_modules/@emnapi/core/dist/emnapi-core.d.ts +0 -392
- package/node_modules/mdream/node_modules/@emnapi/core/dist/emnapi-core.full.d.ts +0 -392
- package/node_modules/mdream/node_modules/@emnapi/core/dist/emnapi-core.full.js +0 -8351
- package/node_modules/mdream/node_modules/@emnapi/core/dist/emnapi-core.js +0 -7268
- package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/async-work.d.ts +0 -5
- package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/async-work.js +0 -843
- package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/index.d.ts +0 -4
- package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/index.js +0 -3
- package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/threadsafe-function.d.ts +0 -5
- package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/threadsafe-function.js +0 -1010
- package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/v8.d.ts +0 -5
- package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/v8.js +0 -1446
- package/node_modules/mdream/node_modules/@emnapi/core/node_modules/@emnapi/wasi-threads/LICENSE +0 -21
- package/node_modules/mdream/node_modules/@emnapi/core/node_modules/@emnapi/wasi-threads/README.md +0 -203
- package/node_modules/mdream/node_modules/@emnapi/core/node_modules/@emnapi/wasi-threads/dist/wasi-threads.d.ts +0 -236
- package/node_modules/mdream/node_modules/@emnapi/core/node_modules/@emnapi/wasi-threads/dist/wasi-threads.js +0 -1086
- package/node_modules/mdream/node_modules/@emnapi/core/node_modules/@emnapi/wasi-threads/package.json +0 -35
- package/node_modules/mdream/node_modules/@emnapi/core/node_modules/@emnapi/wasi-threads/rollup.config.js +0 -6
- package/node_modules/mdream/node_modules/@emnapi/core/package.json +0 -39
- package/node_modules/mdream/node_modules/@emnapi/core/rollup.config.js +0 -60
- package/node_modules/mdream/node_modules/@emnapi/runtime/LICENSE +0 -21
- package/node_modules/mdream/node_modules/@emnapi/runtime/README.md +0 -1
- package/node_modules/mdream/node_modules/@emnapi/runtime/dist/emnapi.d.ts +0 -833
- package/node_modules/mdream/node_modules/@emnapi/runtime/dist/emnapi.js +0 -2306
- package/node_modules/mdream/node_modules/@emnapi/runtime/dist/emnapi.js.map +0 -1
- package/node_modules/mdream/node_modules/@emnapi/runtime/index.cjs +0 -63
- package/node_modules/mdream/node_modules/@emnapi/runtime/package.json +0 -39
- package/node_modules/mdream/node_modules/@emnapi/runtime/rollup.config.js +0 -25
- package/node_modules/mdream/node_modules/@emnapi/wasi-threads/LICENSE +0 -21
- package/node_modules/mdream/node_modules/@emnapi/wasi-threads/README.md +0 -203
- package/node_modules/mdream/node_modules/@emnapi/wasi-threads/dist/wasi-threads.d.ts +0 -240
- package/node_modules/mdream/node_modules/@emnapi/wasi-threads/dist/wasi-threads.js +0 -1118
- package/node_modules/mdream/node_modules/@emnapi/wasi-threads/package.json +0 -35
- package/node_modules/mdream/node_modules/@emnapi/wasi-threads/rollup.config.js +0 -6
- package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/dist/emnapi-plugins.cjs +0 -1472
- package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/dist/emnapi-plugins.js +0 -1470
- package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/dist/fs-proxy.cjs +0 -237
- package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/dist/fs.js +0 -17578
- package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/fs-proxy.js +0 -317
- package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/package.json +0 -67
- package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/runtime.cjs +0 -39
- package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/runtime.js +0 -36
- package/node_modules/mdream/node_modules/@tybys/wasm-util/LICENSE +0 -21
- package/node_modules/mdream/node_modules/@tybys/wasm-util/README.md +0 -193
- package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/tsdoc-metadata.json +0 -11
- package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.d.ts +0 -423
- package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.esm-bundler.js +0 -2932
- package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.esm.js +0 -2932
- package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.esm.min.js +0 -1
- package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.js +0 -2954
- package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.min.js +0 -1
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/asyncify.js +0 -158
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/index.js +0 -13
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/jspi.js +0 -46
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/load.js +0 -97
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/memory.js +0 -35
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/error.js +0 -103
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/fd.js +0 -268
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/fs.js +0 -3
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/index.js +0 -192
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/path.js +0 -316
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/preview1.js +0 -1599
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/rights.js +0 -141
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/types.js +0 -220
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/util.js +0 -128
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/webassembly.js +0 -13
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/asyncify.mjs +0 -153
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/index.mjs +0 -9
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/jspi.mjs +0 -39
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/load.mjs +0 -89
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/memory.mjs +0 -28
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/error.mjs +0 -97
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/fd.mjs +0 -256
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/fs.mjs +0 -1
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/index.mjs +0 -186
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/path.mjs +0 -310
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/preview1.mjs +0 -1593
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/rights.mjs +0 -135
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/types.mjs +0 -216
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/util.mjs +0 -113
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/webassembly.mjs +0 -9
- package/node_modules/mdream/node_modules/@tybys/wasm-util/package.json +0 -58
- package/node_modules/mdream/node_modules/tslib/CopyrightNotice.txt +0 -15
- package/node_modules/mdream/node_modules/tslib/LICENSE.txt +0 -12
- package/node_modules/mdream/node_modules/tslib/README.md +0 -164
- package/node_modules/mdream/node_modules/tslib/SECURITY.md +0 -41
- package/node_modules/mdream/node_modules/tslib/modules/index.d.ts +0 -38
- package/node_modules/mdream/node_modules/tslib/modules/index.js +0 -70
- package/node_modules/mdream/node_modules/tslib/modules/package.json +0 -3
- package/node_modules/mdream/node_modules/tslib/package.json +0 -47
- package/node_modules/mdream/node_modules/tslib/tslib.d.ts +0 -460
- package/node_modules/mdream/node_modules/tslib/tslib.es6.html +0 -1
- package/node_modules/mdream/node_modules/tslib/tslib.es6.js +0 -402
- package/node_modules/mdream/node_modules/tslib/tslib.es6.mjs +0 -401
- package/node_modules/mdream/node_modules/tslib/tslib.html +0 -1
- package/node_modules/mdream/node_modules/tslib/tslib.js +0 -484
- package/node_modules/mdream/package.json +0 -110
- package/node_modules/mdream/skills/mdream/SKILL.md +0 -124
- package/node_modules/mdream/skills/mdream/references/runtimes.md +0 -49
- package/node_modules/mdream/wasm/mdream_edge.d.ts +0 -90
- package/node_modules/mdream/wasm/mdream_edge.js +0 -517
- package/node_modules/mdream/wasm/mdream_edge_bg.wasm +0 -0
- package/node_modules/mdream/wasm/mdream_edge_bg.wasm.d.ts +0 -20
- package/node_modules/mdream/wasm/package.json +0 -17
- package/node_modules/mdream/wasm-bundler/mdream_edge.d.ts +0 -45
- package/node_modules/mdream/wasm-bundler/mdream_edge.js +0 -13
- package/node_modules/mdream/wasm-bundler/mdream_edge_bg.js +0 -413
- package/node_modules/mdream/wasm-bundler/mdream_edge_bg.wasm +0 -0
- package/node_modules/mdream/wasm-bundler/mdream_edge_bg.wasm.d.ts +0 -20
- package/node_modules/mdream/wasm-bundler/package.json +0 -19
- package/node_modules/pathe/LICENSE +0 -70
- package/node_modules/pathe/README.md +0 -73
- package/node_modules/pathe/dist/index.cjs +0 -39
- package/node_modules/pathe/dist/index.d.cts +0 -47
- package/node_modules/pathe/dist/index.d.mts +0 -47
- package/node_modules/pathe/dist/index.d.ts +0 -47
- package/node_modules/pathe/dist/index.mjs +0 -19
- package/node_modules/pathe/dist/shared/pathe.BSlhyZSM.cjs +0 -266
- package/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs +0 -249
- package/node_modules/pathe/dist/utils.cjs +0 -82
- package/node_modules/pathe/dist/utils.d.cts +0 -32
- package/node_modules/pathe/dist/utils.d.mts +0 -32
- package/node_modules/pathe/dist/utils.d.ts +0 -32
- package/node_modules/pathe/dist/utils.mjs +0 -77
- package/node_modules/pathe/package.json +0 -61
- package/node_modules/pathe/utils.d.ts +0 -1
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: mdream
|
|
3
|
-
description: Convert HTML to Markdown, plain text, or safe HTML with mdream, the Rust engine for Node, edge, and the browser. Use when a task mentions mdream, htmlToMarkdown, streamHtmlToMarkdown, the minimal preset, frontmatter or extraction callbacks, tagOverrides, clean options, the mdream CLI, or errors such as "Custom hook plugins require @mdream/js" or ERR_PACKAGE_PATH_NOT_EXPORTED for mdream/plugins.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# mdream
|
|
7
|
-
|
|
8
|
-
This Skill covers `mdream` 2.0.0-beta.0. The package wraps a Rust converter: NAPI in Node, WASM on edge runtimes and in the browser.
|
|
9
|
-
`@mdream/js` is a separate pure JS engine. It has hook plugins, the splitter, `llms.txt` generation, and content negotiation. Its option shape differs; see [Traps](#traps).
|
|
10
|
-
|
|
11
|
-
## Setup
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
import { htmlToMarkdown } from 'mdream'
|
|
15
|
-
|
|
16
|
-
const markdown = htmlToMarkdown('<main><h1>Docs</h1></main>', {
|
|
17
|
-
origin: 'https://example.com',
|
|
18
|
-
minimal: true,
|
|
19
|
-
})
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
- `htmlToMarkdown` is synchronous in Node and on edge runtimes. It returns a string.
|
|
23
|
-
- Set `origin` to make relative `href` and `src` values absolute. Without it, they stay relative.
|
|
24
|
-
- If a bundler fails on the native binding, mark `mdream` as external. In Next.js, add it to `serverExternalPackages`. `@mdream/vite` does this for you.
|
|
25
|
-
|
|
26
|
-
## Automatic behaviour
|
|
27
|
-
|
|
28
|
-
Default output keeps everything: navigation, forms, footers, and text hidden with CSS classes.
|
|
29
|
-
The `<title>` text never appears in the body. Read it with `frontmatter` or `extraction`.
|
|
30
|
-
|
|
31
|
-
`minimal: true` turns on these options. Each one is off without it.
|
|
32
|
-
|
|
33
|
-
| Option | Effect under `minimal` |
|
|
34
|
-
|---|---|
|
|
35
|
-
| `frontmatter` | YAML frontmatter from `<title>` and `<meta>`. |
|
|
36
|
-
| `isolateMain` | Keeps `<main>`, else the content from the first heading to the first `<footer>`. |
|
|
37
|
-
| `tailwind` | `font-bold` becomes `**bold**`. `hidden` and `absolute` content is dropped. |
|
|
38
|
-
| `filter` | Excludes `form`, `fieldset`, `object`, `embed`, `footer`, `aside`, `iframe`, `input`, `textarea`, `select`, `button`, `nav`. |
|
|
39
|
-
| `clean` | All cleanup: tracking parameters, `#` links, images without alt, and more. |
|
|
40
|
-
|
|
41
|
-
To turn one off, pass it as `false`: `{ minimal: true, frontmatter: false, clean: false }`.
|
|
42
|
-
A `filter` under `minimal` adds to the excludes above: `{ minimal: true, filter: { exclude: ['h1'] } }` drops `h1` and every default tag. `filter: false` keeps forms and `nav`.
|
|
43
|
-
|
|
44
|
-
## Common tasks
|
|
45
|
-
|
|
46
|
-
Read metadata and matched elements in one pass:
|
|
47
|
-
|
|
48
|
-
```ts
|
|
49
|
-
import { htmlToMarkdown } from 'mdream'
|
|
50
|
-
|
|
51
|
-
const links: string[] = []
|
|
52
|
-
let title = ''
|
|
53
|
-
const markdown = htmlToMarkdown('<html><head><title>T</title></head><body><a href="/a">A</a></body></html>', {
|
|
54
|
-
frontmatter: (fm) => { title = fm.title ?? '' },
|
|
55
|
-
extraction: {
|
|
56
|
-
'a[href]': (el) => { links.push(el.attributes.href ?? '') },
|
|
57
|
-
},
|
|
58
|
-
})
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
Stream a large response. The stream takes the same options, and the callbacks run once, after the last chunk is read:
|
|
62
|
-
|
|
63
|
-
```ts
|
|
64
|
-
import { streamHtmlToMarkdown } from 'mdream'
|
|
65
|
-
|
|
66
|
-
const response = await fetch('https://example.com')
|
|
67
|
-
let markdown = ''
|
|
68
|
-
let title = ''
|
|
69
|
-
for await (const chunk of streamHtmlToMarkdown(response.body, {
|
|
70
|
-
origin: 'https://example.com',
|
|
71
|
-
minimal: true,
|
|
72
|
-
frontmatter: (fm) => { title = fm.title ?? '' },
|
|
73
|
-
})) {
|
|
74
|
-
markdown += chunk
|
|
75
|
-
}
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
Render a custom element with Markdown semantics. Unknown tags output only their text.
|
|
79
|
-
|
|
80
|
-
```ts
|
|
81
|
-
import { htmlToMarkdown } from 'mdream'
|
|
82
|
-
|
|
83
|
-
htmlToMarkdown('<x-heading>Title</x-heading><callout>Read this</callout>', {
|
|
84
|
-
tagOverrides: {
|
|
85
|
-
'x-heading': 'h2',
|
|
86
|
-
'callout': { enter: '> **Note:** ', exit: '', spacing: [2, 2] },
|
|
87
|
-
},
|
|
88
|
-
})
|
|
89
|
-
// ## Title\n\n> **Note:** Read this
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
Other output: `format: 'text'` gives plain text, `format: 'html'` gives allowlisted semantic HTML. `wrapWidth: 80` wraps prose only, never code, tables, or headings.
|
|
93
|
-
|
|
94
|
-
CLI: `curl -s URL | mdream --origin URL --preset minimal`. It streams stdin to stdout. Flags: `--format`, `--text`, `--wrap-width`.
|
|
95
|
-
|
|
96
|
-
## Traps
|
|
97
|
-
|
|
98
|
-
- **Hook plugins are not in this package.** An array in `plugins` throws `Custom hook plugins require @mdream/js`. Use `@mdream/js` with `hooks: [createPlugin({...})]` from `@mdream/js/plugins`.
|
|
99
|
-
- **`@mdream/js` nests options under `plugins`.** It throws a `TypeError` on `minimal`, `frontmatter`, `isolateMain`, `tailwind`, `filter`, `extraction`, or `tagOverrides` at the top level. Use `withMinimalPreset()` from `@mdream/js/preset/minimal`, or `{ plugins: { frontmatter: true } }`.
|
|
100
|
-
- **Emphasis is `*`, not `_`.** Headings are ATX, bullets are `-`, rules are `---`. Only `tagOverrides` changes a delimiter, for example `em: { enter: '_', exit: '_', isInline: true }`.
|
|
101
|
-
- **Filter selectors also drop inline `position: absolute` and `position: fixed` elements.**
|
|
102
|
-
- **Browser and CDN entries are async.** Every entry takes the same options and produces the same string. The browser bundle and the CDN script return `Promise<string>`, so `await` them. Read [references/runtimes.md](references/runtimes.md) before you use `mdream` outside Node or a Cloudflare Worker.
|
|
103
|
-
|
|
104
|
-
## Version limits
|
|
105
|
-
|
|
106
|
-
Code from mdream 0.x fails on 1.x and 2.x. The subpaths `mdream/plugins`, `mdream/preset/minimal`, `mdream/splitter`, `mdream/llms-txt`, and `mdream/negotiate` throw `ERR_PACKAGE_PATH_NOT_EXPORTED`.
|
|
107
|
-
|
|
108
|
-
```ts
|
|
109
|
-
// Old (0.x):
|
|
110
|
-
// import { htmlToMarkdown } from 'mdream'
|
|
111
|
-
// import { withMinimalPreset } from 'mdream/preset/minimal'
|
|
112
|
-
// htmlToMarkdown(html, withMinimalPreset({ origin }))
|
|
113
|
-
|
|
114
|
-
import { htmlToMarkdown } from 'mdream'
|
|
115
|
-
|
|
116
|
-
// New:
|
|
117
|
-
htmlToMarkdown('<p>x</p>', { minimal: true, origin: 'https://example.com' })
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
The splitter, `llms.txt` generation, and `shouldServeMarkdown` moved to `@mdream/js/splitter`, `@mdream/js/llms-txt`, and `@mdream/js/negotiate`.
|
|
121
|
-
|
|
122
|
-
## Config
|
|
123
|
-
|
|
124
|
-
Options: `origin`, `minimal`, `clean` (`true` or per rule), `frontmatter`, `isolateMain`, `tailwind`, `filter`, `extraction`, `tagOverrides`, `wrapWidth`, `format`. Types: `MdreamOptions` in the [package README](https://github.com/harlan-zw/mdream/tree/main/packages/mdream#options).
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
# mdream outside Node
|
|
2
|
-
|
|
3
|
-
`mdream` picks an entry by export condition. Every entry takes the same `MdreamOptions`: `minimal`, `frontmatter`, `filter`, `extraction`, `tagOverrides`, and the callbacks work everywhere. Every entry produces a Markdown string. Some return it in a Promise.
|
|
4
|
-
|
|
5
|
-
| Import | Resolved by | Returns |
|
|
6
|
-
|---|---|---|
|
|
7
|
-
| `mdream` | Node | `string` |
|
|
8
|
-
| `mdream` | `workerd`, `edge-light` | `string` |
|
|
9
|
-
| `mdream` | `browser` | `Promise<string>` |
|
|
10
|
-
| `mdream/worker` | direct import | `Promise<string>` |
|
|
11
|
-
| `mdream/wasm` | direct import | `string`, after `init()` |
|
|
12
|
-
| `dist/iife.js` (CDN) | script tag | `Promise<string>` |
|
|
13
|
-
|
|
14
|
-
Each export condition ships its own types. TypeScript reads the `browser` types only when it resolves that condition, for example with `customConditions: ["browser"]` or a bundler that sets it. Otherwise it shows the Node types, a synchronous string.
|
|
15
|
-
|
|
16
|
-
## Cloudflare Workers and Vercel Edge
|
|
17
|
-
|
|
18
|
-
The `workerd` and `edge-light` conditions load the WASM build and instantiate it at import. The API matches Node.
|
|
19
|
-
|
|
20
|
-
```ts
|
|
21
|
-
import { htmlToMarkdown } from 'mdream'
|
|
22
|
-
|
|
23
|
-
export default {
|
|
24
|
-
async fetch(request: Request): Promise<Response> {
|
|
25
|
-
const html = await request.text()
|
|
26
|
-
return new Response(htmlToMarkdown(html, { minimal: true }))
|
|
27
|
-
},
|
|
28
|
-
}
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
A Rust panic becomes a normal `Error` with the message `mdream WASM panic, please report this at ...`. The instance stays usable, so catch it per request.
|
|
32
|
-
|
|
33
|
-
## Browser bundles
|
|
34
|
-
|
|
35
|
-
In a Vite, webpack, or esbuild client build, `import { htmlToMarkdown } from 'mdream'` resolves the `browser` entry. That entry fetches the WASM binary on first use and returns `Promise<string>`, so `await` it. The options and callbacks work as in Node.
|
|
36
|
-
|
|
37
|
-
```ts
|
|
38
|
-
import { htmlToMarkdown } from 'mdream'
|
|
39
|
-
|
|
40
|
-
const markdown = await htmlToMarkdown(html, { minimal: true })
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
For browser code that wants a plain string with no WASM, `@mdream/js` is synchronous. Its options nest under `plugins`.
|
|
44
|
-
|
|
45
|
-
## Web Worker, raw WASM, and CDN
|
|
46
|
-
|
|
47
|
-
- `mdream/worker`: call `initWorker(wasmUrl)` first, then `await htmlToMarkdown(html, options)`. Call `terminateWorker()` when done. Options resolve on the main thread, and the callbacks run there.
|
|
48
|
-
- `mdream/wasm`: the wasm-bindgen build. Await the default export `init({ module_or_path })` before the first `htmlToMarkdown(html, options)` call. Its `MarkdownStream` runs the callbacks in `finish()`.
|
|
49
|
-
- `https://unpkg.com/mdream/dist/iife.js`: the WASM is inlined and ready at load. `window.mdream` has only `htmlToMarkdown`. There is no `init()`. The call returns `Promise<string>`, the same as the browser bundle.
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
|
|
4
|
-
export class MarkdownStream {
|
|
5
|
-
free(): void;
|
|
6
|
-
[Symbol.dispose](): void;
|
|
7
|
-
finish(): string;
|
|
8
|
-
constructor(options: any);
|
|
9
|
-
/**
|
|
10
|
-
* Byte chunk in, string out, skipping the transcode per chunk. A sequence
|
|
11
|
-
* split across chunks carries to the next call rather than decoding early,
|
|
12
|
-
* matching `TextDecoder({ stream: true })`; invalid bytes become U+FFFD.
|
|
13
|
-
*/
|
|
14
|
-
processChunkBytes(chunk: Uint8Array): string;
|
|
15
|
-
/**
|
|
16
|
-
* A carried byte tail cannot be completed by a string chunk, so it is
|
|
17
|
-
* flushed first. Byte and string chunks may be mixed freely.
|
|
18
|
-
*/
|
|
19
|
-
processChunk(chunk: string): string;
|
|
20
|
-
/**
|
|
21
|
-
* Frontmatter and extracted elements collected so far, as
|
|
22
|
-
* `{ frontmatter?, extracted? }`. Call after `finish()` for the complete
|
|
23
|
-
* data. Extracted elements drain on each call.
|
|
24
|
-
*/
|
|
25
|
-
takeData(): any;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Consumes the message of the panic that aborted the last export call.
|
|
30
|
-
*/
|
|
31
|
-
export function __mdreamTakePanicMessage(): string | undefined;
|
|
32
|
-
|
|
33
|
-
export function htmlToMarkdown(html: string, options: any): string;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Bytes in, string out: skips the transcode (~14% of a convert) for a
|
|
37
|
-
* caller already holding UTF-8 bytes. Encoding a string to get here
|
|
38
|
-
* measures 1-16% *slower* than [`html_to_markdown`] — only worth it when
|
|
39
|
-
* the bytes are already in hand.
|
|
40
|
-
*/
|
|
41
|
-
export function htmlToMarkdownBytes(html: Uint8Array, options: any): string;
|
|
42
|
-
|
|
43
|
-
export function htmlToMarkdownResult(html: string, options: any): any;
|
|
44
|
-
|
|
45
|
-
export function install_panic_hook(): void;
|
|
46
|
-
|
|
47
|
-
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
48
|
-
|
|
49
|
-
export interface InitOutput {
|
|
50
|
-
readonly memory: WebAssembly.Memory;
|
|
51
|
-
readonly __mdreamTakePanicMessage: (a: number) => void;
|
|
52
|
-
readonly __wbg_markdownstream_free: (a: number, b: number) => void;
|
|
53
|
-
readonly htmlToMarkdown: (a: number, b: number, c: number, d: number) => void;
|
|
54
|
-
readonly htmlToMarkdownBytes: (a: number, b: number, c: number, d: number) => void;
|
|
55
|
-
readonly htmlToMarkdownResult: (a: number, b: number, c: number) => number;
|
|
56
|
-
readonly install_panic_hook: () => void;
|
|
57
|
-
readonly markdownstream_finish: (a: number, b: number) => void;
|
|
58
|
-
readonly markdownstream_new: (a: number) => number;
|
|
59
|
-
readonly markdownstream_processChunk: (a: number, b: number, c: number, d: number) => void;
|
|
60
|
-
readonly markdownstream_processChunkBytes: (a: number, b: number, c: number, d: number) => void;
|
|
61
|
-
readonly markdownstream_takeData: (a: number) => number;
|
|
62
|
-
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
63
|
-
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
64
|
-
readonly __wbindgen_export3: (a: number) => void;
|
|
65
|
-
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
66
|
-
readonly __wbindgen_export4: (a: number, b: number, c: number) => void;
|
|
67
|
-
readonly __wbindgen_start: () => void;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Instantiates the given `module`, which can either be bytes or
|
|
74
|
-
* a precompiled `WebAssembly.Module`.
|
|
75
|
-
*
|
|
76
|
-
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
77
|
-
*
|
|
78
|
-
* @returns {InitOutput}
|
|
79
|
-
*/
|
|
80
|
-
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
84
|
-
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
85
|
-
*
|
|
86
|
-
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
87
|
-
*
|
|
88
|
-
* @returns {Promise<InitOutput>}
|
|
89
|
-
*/
|
|
90
|
-
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|