#16
format.mjs: replacing the marked block strips indentation from the content after it
replaceMarkedBlock trims the text that follows the end marker:
const suffix = body.slice(afterEnd).trim();.trim() also removes the leading spaces of the first line after the block. When that line is part of an indented code block, it no longer renders as code. This conflicts with the SKILL.md promise to "preserve every byte of unrelated prose".
Repro (four-space indented code right after the block):
Intro
<!-- before-and-after:start -->
old
<!-- before-and-after:end -->
indented code line
second linenode skill/scripts/format.mjs --body-file body.md --after a.gifOutput ends with:
indented code line
second linePossible fix: strip only leading blank lines, e.g. body.slice(afterEnd).replace(/^(?:[ \t]*\r?\n)+/, "").trimEnd(), plus a test with indented content directly after the block.
Activity
0No activity yet.