You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems to be due to faulty parsing by the Markdown library (is this library part of Yii? I'm not sure). Apparently the Craft team may have come across this bug before, since there is a comment in app/Controllers/TemplatesController.php line 202 that says:
// Escape any inner-word underscores, which Markdown mistakes for italics
// TODO: This won't be necessary in 3.0 thanks to Parsedown
$variables['message'] = preg_replace('/(?<=[a-zA-Z])_(?=[a-zA-Z])/', '\_', $variables['message']);
Unfortunately this workaround is not applied in EmailService so the issue persists.
This can also break Craft links such as craft()->users->getPasswordResetUrl($user) which appear to sometimes contain underscores.
Although there are a couple of workarounds below, developers are unlikely to expect this behaviour, so perhaps a workaround is needed until such point that the Markdown library is updated/replaced.
Workarounds
Wrap URL in <angle brackets>. This tells Markdown to render a clickable link, and not treat it as plain text.
Provide an HTML version of the email message. This prevents the Markdown-to-HTML conversion
Unfortunately there's currently no way to ask Craft to send plaintext only, see issue #1107.
Additional info
Craft version: 2.6.2981
PHP version: 5.6.30
Database driver & version:
The text was updated successfully, but these errors were encountered:
In Craft 2.6, when sending a plaintext email that contains underscores, these are often converted to
<em>
tags which can mangle and break URLs.Unfortunately the resulting body of the email is mangled and appears like this:
It seems to be due to faulty parsing by the Markdown library (is this library part of Yii? I'm not sure). Apparently the Craft team may have come across this bug before, since there is a comment in
app/Controllers/TemplatesController.php
line 202 that says:Unfortunately this workaround is not applied in EmailService so the issue persists.
This can also break Craft links such as
craft()->users->getPasswordResetUrl($user)
which appear to sometimes contain underscores.Although there are a couple of workarounds below, developers are unlikely to expect this behaviour, so perhaps a workaround is needed until such point that the Markdown library is updated/replaced.
Workarounds
Wrap URL in
<angle brackets>
. This tells Markdown to render a clickable link, and not treat it as plain text.Provide an HTML version of the email message. This prevents the Markdown-to-HTML conversion
Unfortunately there's currently no way to ask Craft to send plaintext only, see issue #1107.
Additional info
The text was updated successfully, but these errors were encountered: