Skip to content

Apostrophe not being escaped in markdown mail templates #54830

Open
@seb-jones

Description

@seb-jones

Laravel Version

12

PHP Version

8.4

Database Driver & Version

N/A

Description

Hi,

We are finding that variables echoed into Markdown Mailables are not having the Apostrophe character escaped. This has created some confusion in tests because assertSeeInHtml does escape the Apostrophe character.

Is this expected behaviour?

Steps To Reproduce

  1. Create a new Laravel 12 installation.

  2. Create a Markdown Mailable, e.g:

php artisan make:mail EscapeTest --markdown=mail.escape-test
  1. In the markdown file, echo some characters that you would expect to be escaped, including the Apostrophe:
<x-mail::message>

{{ "<script ' &" }}

</x-mail::message>
  1. Return the mailable from the / web route for testing:
Route::get('/', function () {
    return new \App\Mail\EscapeTest;
});
  1. Navigate to the website in the browser and observe in Dev Tools that the Apostrophe character is not escaped, while the other characters are:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions