From ae3045f96b238b1abadcaed1f17a595f818a9964 Mon Sep 17 00:00:00 2001 From: hypercross Date: Wed, 8 Jul 2026 16:49:01 +0800 Subject: [PATCH] fix(cli): preserve inline blocks without file or as attributes --- src/cli/inline-blocks.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/cli/inline-blocks.ts b/src/cli/inline-blocks.ts index 98756ec..5e6dc7b 100644 --- a/src/cli/inline-blocks.ts +++ b/src/cli/inline-blocks.ts @@ -70,6 +70,11 @@ export function extractInlineBlocks( (_match: string, lang: string, infoString: string, body: string) => { const attrs = parseAttrs(infoString); + // Only process blocks that have `file` or `as`; leave others untouched + if (!attrs.file && !attrs.as) { + return _match; + } + // Determine filename: explicit `file` or content-hash generated const filename = attrs.file || `_inline_${contentHash(body)}.${lang || "txt"}`; @@ -94,7 +99,7 @@ export function extractInlineBlocks( return `:${attrs.as}[./${filename}]${extraStr}`; } - return ""; // no `as` — strip the block entirely + return ""; // has `file` but no `as` — strip the block (body is already injected into index) }, ); }