From 2bc26fbdc569fca140bbb4c56eeca708a9739b53 Mon Sep 17 00:00:00 2001 From: James Maes Date: Fri, 16 Oct 2026 16:11:29 -0500 Subject: [PATCH] fix(publisher): make heading regex linear-time Co-Authored-By: Claude Opus 5.5 --- packages/publisher/src/markdown/converter.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/publisher/src/markdown/converter.ts b/packages/publisher/src/markdown/converter.ts index d9cfaf5..7d79801 100644 --- a/packages/publisher/src/markdown/converter.ts +++ b/packages/publisher/src/markdown/converter.ts @@ -49,7 +49,8 @@ export class MarkdownConverter { const line = lines[i]; // Heading - const headingMatch = line.match(/^(#{1,6})\s+(.+)$/); + // `\s+(\S.*)` keeps the separator and the text disjoint, so matching is linear. + const headingMatch = line.match(/^(#{1,6})\s+(\S.*)$/); if (headingMatch) { tokens.push({ type: 'heading', -- 2.54.0