Skip to content

Commit e1394f4

Browse files
committed
fix: protect Game tag from rendering inside inline code backticks
1 parent 4be10af commit e1394f4

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Changelog — Game Tag Inline Code Fix
2+
3+
**Date:** 2026-03-18
4+
5+
## Summary
6+
7+
Fixed `{{@Game:}}` tags inside inline code backticks being incorrectly rendered as Game Builder cards instead of plain text.
8+
9+
## Problem
10+
11+
In the Feature Showcase template's "AI Document Tags" row, `` `{{@Game:}}` `` was rendering as a full Game Builder card with engine selectors, model dropdowns, and action buttons — despite being wrapped in backticks (inline code), which should display it as literal text.
12+
13+
All other DocGen tags (`{{@AI:}}`, `{{@Image:}}`, `{{@Draw:}}`, etc.) correctly displayed as inline code text because their respective modules included inline code span detection in `getFencedRanges()`.
14+
15+
## Root Cause
16+
17+
`game-docgen.js`'s `getFencedRanges()` only detected fenced code blocks (triple backticks) but was missing inline code span detection (single backticks). This allowed the tag regex to match `{{@Game:}}` even when it appeared inside inline code.
18+
19+
## Changes
20+
21+
### Modified
22+
23+
- **`js/game-docgen.js`** — Added inline code span detection (`/\`([^\`\n]+)\`/g`) to `getFencedRanges()`, matching the pattern already used by `ai-docgen.js`, `draw-docgen.js`, `api-docgen.js`, and `linux-docgen.js`.

js/game-docgen.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@
103103
openIdx = -1;
104104
}
105105
}
106+
// Inline code spans (`...`)
107+
var inlineRe = /`([^`\n]+)`/g;
108+
while ((m = inlineRe.exec(md)) !== null) {
109+
ranges.push([m.index, m.index + m[0].length]);
110+
}
106111
return ranges;
107112
}
108113

0 commit comments

Comments
 (0)