Skip to content

fix(docs): escape example Blade expression in mobile v4 Text doc#424

Merged
simonhamp merged 1 commit into
mainfrom
fix-verbatim-text-doc
Jul 10, 2026
Merged

fix(docs): escape example Blade expression in mobile v4 Text doc#424
simonhamp merged 1 commit into
mainfrom
fix-verbatim-text-doc

Conversation

@simonhamp

Copy link
Copy Markdown
Member

Summary

The mobile v4 Text edge-component doc page (/docs/mobile/4/edge-components/text) was returning a 500 in production with ErrorException: Undefined variable $variable.

Documentation .md files are rendered through the Blade engine before markdown conversion (ShowDocumentationController::getMarkdownView maps .md → the blade engine). The "Dynamic content" <aside> contained an inline example in prose:

Blade expressions like `{{ $variable }}` work inside text slots.

That {{ $variable }} was neither wrapped in @verbatim nor escaped, so Blade evaluated it as a real variable and threw. (Markdown backticks don't help — Blade runs first. The nearby {{ $score }} example was fine because it lives inside a @verbatim block.)

Fix

Escape the inline expression with @{{ }} — the same convention already used elsewhere in the docs (e.g. super-native/reactivity.md). Blade now emits the literal {{ $variable }}, so the reader still sees the intended text and the page renders.

Tests

tests/Feature/DocumentationRenderingTest.php:

  • Regression: GET /docs/mobile/4/edge-components/text returns 200 and shows the literal {{ $variable }}.
  • Class-wide guard: renders all 335 docs pages as Blade and asserts none throws — catching any other unescaped example expressions across the docs tree.

Both tests fail on the un-fixed doc (reproducing the exact Undefined variable $variable 500) and pass with the fix. Pint is clean.

Fixes #72

The "Dynamic content" aside contained an inline `{{ $variable }}` in prose
that was neither wrapped in @verbatim nor escaped. Doc .md files render through
the Blade engine before markdown conversion, so Blade evaluated it and threw
"Undefined variable $variable", 500ing the page. Escape it with @{{ }} (the
convention already used elsewhere) so the literal renders.

Adds a regression test plus a guard that renders every docs page as Blade to
catch any other unescaped example expressions.

Fixes #72

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@simonhamp simonhamp marked this pull request as ready for review July 10, 2026 16:41
@simonhamp simonhamp merged commit a473f67 into main Jul 10, 2026
2 checks passed
@simonhamp simonhamp deleted the fix-verbatim-text-doc branch July 10, 2026 16:42
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.

1 participant