Skip to content

Conversation

@nicodevs
Copy link
Contributor

@nicodevs nicodevs commented Nov 21, 2025

Fixes #749 - PHPDoc {@inheritDoc} annotations in markdown code blocks were being corrupted.

Given the following Markdown:

---
extends: _layouts.main
section: body
---

# Test Page with PHP code

```php
/**
 * {@inheritDoc}
 */
function test() {}
```

The @ escaping ('@' => "{{'@'}}") was turning {@inheritDoc} into {{{'@'}}inheritDoc} - three opening braces, which is invalid Blade syntax. The build failed with a ParseError: syntax error, unexpected token "{".

The fix: Add '{@' => '{@' to the replacement array. Since strtr prioritizes longer matches first, {@ is matched before @, preserving the original sequence.

Added test case for {@inheritDoc} in code blocks.

@nicodevs nicodevs force-pushed the nd/fix-escaping-in-markdown-to-preserve-phpdoc-annotations-like-inheritdoc branch from fa78b77 to f78a1f2 Compare November 21, 2025 15:24
@nicodevs nicodevs self-assigned this Nov 21, 2025
............................................................................
...................................✓......

──────────────────────────────────────────────────────────────────── Laravel
FIXED ................................... 118 files, 1 style issue fixed
✓ src/Console/BuildCommand.php not_operator_with_successor_space, no_whites…
)
@nicodevs nicodevs marked this pull request as ready for review November 21, 2025 15:25
@nicodevs nicodevs requested a review from damiani November 21, 2025 15:26
@damiani damiani merged commit e5e4674 into main Nov 21, 2025
@damiani damiani deleted the nd/fix-escaping-in-markdown-to-preserve-phpdoc-annotations-like-inheritdoc branch November 21, 2025 15:31
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.

Bug: Aggressive '@' escaping in MarkdownHandler breaks PHPDoc annotations

3 participants