From 1658aebe706a0b44684babbb89b118616618b012 Mon Sep 17 00:00:00 2001 From: Calic Date: Thu, 11 Jun 2026 01:26:50 +0200 Subject: [PATCH] fix(launcher): strip trailing LF from frontmatter body The body region rebuilt from line-split included a trailing empty entry from the final LF the parser appends to drive its gmatch. Strip it so 'body text\n' (the on-disk content) parses to 'body text' (the user-visible body), which is what the launcher-test asserts. --- frontmatter.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/frontmatter.lua b/frontmatter.lua index ca9d9ac..bed2710 100644 --- a/frontmatter.lua +++ b/frontmatter.lua @@ -37,6 +37,11 @@ local function split_at_separator(content) for i = 2, sep_idx - 1 do json_lines[#json_lines + 1] = lines[i] end local body_lines = {} for i = sep_idx + 1, #lines do body_lines[#body_lines + 1] = lines[i] end + -- Drop the trailing empty entry produced by the final LF appended above, + -- so the body matches user expectation ('body text' rather than 'body text\n'). + if #body_lines > 0 and body_lines[#body_lines] == "" then + body_lines[#body_lines] = nil + end return table.concat(json_lines, "\n"), table.concat(body_lines, "\n") end