From d29d8b0af0cdb915e4b18d3e57448f171bd42750 Mon Sep 17 00:00:00 2001 From: James Brechtel Date: Wed, 20 May 2026 16:04:16 -0400 Subject: [PATCH] fix: separate steps with blank lines in Cooklang renderer The Cooklang parser (splitByBlankLines) identifies step boundaries by blank lines (\n\n). renderSection was joining body items with a single newline (\n), causing multiple steps to be parsed as one. Fixed by using \n\n as the separator between body items, matching the spec. --- src/Roux/CooklangPrint.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Roux/CooklangPrint.hs b/src/Roux/CooklangPrint.hs index 4912692..05d1756 100644 --- a/src/Roux/CooklangPrint.hs +++ b/src/Roux/CooklangPrint.hs @@ -85,7 +85,10 @@ renderBody recipe = body = T.intercalate "\n" rendered in if T.null body then Nothing else Just body --- | Render a single section. +{- | Render a single section. +Steps within a section are separated by blank lines, which is how +the Cooklang parser identifies step boundaries. +-} renderSection :: Section -> Text renderSection section = let header = case sectionName section of @@ -93,7 +96,7 @@ renderSection section = Nothing -> T.empty items = toList (sectionBody section) steps = map renderBodyItem items - in header <> T.intercalate "\n" steps + in header <> T.intercalate "\n\n" steps -- | Render a single section body item (step, comment, or note). renderBodyItem :: SectionBodyItem -> Text