diff --git a/site/api/components/P.tsx b/site/api/components/P.tsx index b2be4ed3d..4a40c9be9 100644 --- a/site/api/components/P.tsx +++ b/site/api/components/P.tsx @@ -21,9 +21,11 @@ export function P( continue; } if (!inCodeBlock) { - while (/<.+>/.test(part)) { - part = part.replace(/<(.+)>/, "<$1>"); - } + // Escape each pair of angle brackets individually. The inner class + // `[^<>]+` keeps a single `<...>` from greedily swallowing every + // bracketed placeholder in the same sentence — see + // https://github.com/grammyjs/website/issues/1027. + part = part.replace(/<([^<>]+)>/g, "<$1>"); newParts.push(part); } else { newParts.push(part);