Skip to content

fix(web/blog): unescape quoted announcement values in the Discussion announcer - #4604

Merged
bpamiri merged 1 commit into
developfrom
peter/announce-unescape-quotes
Oct 15, 2026
Merged

bpamiri merged 1 commit into
developfrom
peter/announce-unescape-quotes

Conversation

@bpamiri

@bpamiri bpamiri commented Oct 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

extractAnnouncement() in web/scripts/blog-announce-discussion.mjs stripped the outer quotes from each announcement: value but left YAML escapes in place. So

announcement:
  title: 'Part 4: the file the upgrade doesn''t touch'

produced the Discussion title …doesn''t touch, while the blog page showed doesn't. Double-quoted values kept \" and \\ the same way.

A small unquoteScalar() helper now:

  • decides the quote style once and strips one layer;
  • turns '' into ' in single quotes;
  • unescapes \" and \\ in double quotes, in one left-to-right pass.

It also stops '"x"' being stripped twice, which the old chained replaces did. Other double-quoted escapes (\n, \t, \u…) stay literal, as before. It adds no new dependencies, and extractSlug() is unchanged.

Fixes #4512

Testing

node --test web/scripts/blog-announce-discussion.test.mjs:

  • Four new cases: a single-quoted '', a double-quoted \" / \\, strip-only-once, and an unquoted value.
  • Against the old code: 23/26, with the three escape cases failing.
  • With this change: 26/26.

🤖 Generated with Claude Code

…announcer

extractAnnouncement() stripped the outer quotes from each announcement
scalar but left YAML escapes in place, so a single-quoted title with ''
produced a Discussion title with a doubled apostrophe, while the blog page
showed it correctly. Double-quoted values kept \" and \\ the same way.

A small unquoteScalar() helper now decides the quote style once, strips
one layer, and unescapes for that style ('' to ' in single quotes; \" and
\\ in double quotes). It also stops a single-quoted value whose content is
wrapped in double quotes from being stripped twice.

Fixes #4512

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>
@bpamiri
bpamiri merged commit 231af0c into develop Oct 15, 2026
23 checks passed
@bpamiri
bpamiri deleted the peter/announce-unescape-quotes branch October 15, 2026 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

blog announcer: single-quoted frontmatter values keep YAML's doubled quote

1 participant