From d0915c5ea5e66960505414f41601d98feb2fabf7 Mon Sep 17 00:00:00 2001 From: max-digi Date: Thu, 7 May 2026 18:30:07 +0100 Subject: [PATCH] fix(sync): quote authors with @ to prevent YAML parse error Upstream TIPs occasionally include GitHub handles like @0xrusowsky in the authors field. The leading @ is a YAML reserved character and breaks the build. Quote the value defensively when it begins with any YAML reserved char. Amp-Thread-ID: https://ampcode.com/threads/T-019e0366-1385-70ac-8cf3-1738206b7d0e Co-authored-by: Amp --- vite.config.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vite.config.ts b/vite.config.ts index aea1b131..27ce7716 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -124,6 +124,13 @@ function syncTips(): Plugin { // Escape angle brackets outside of code blocks/inline code so MDX doesn't // treat them as JSX (e.g. `Mapping` in prose). content = escapeAngleBrackets(content) + // Quote frontmatter `authors:` values that start with a YAML reserved + // character (e.g. `@handle`). Upstream TIPs occasionally include GitHub + // handles like `@0xrusowsky`, which break YAML parsing unless quoted. + content = content.replace( + /^(authors:\s*)([@&*!|>%#`].*)$/m, + (_m, prefix, value) => `${prefix}"${value.replace(/"/g, '\\"')}"`, + ) const outputPath = path.join(outputDir, file.name.replace('.md', '.mdx')) await fs.writeFile(outputPath, content) }),