diff --git a/application/Espo/Services/EmailNotification.php b/application/Espo/Services/EmailNotification.php index 5cc6b61777..d6c0b6e7e9 100644 --- a/application/Espo/Services/EmailNotification.php +++ b/application/Espo/Services/EmailNotification.php @@ -329,7 +329,9 @@ class EmailNotification extends \Espo\Core\Services\Base $data['userName'] = $note->get('createdByName'); - $data['post'] = nl2br($note->get('post')); + $post = $note->get('post') ?? ''; + $post = \Michelf\Markdown::defaultTransform($post); + $data['post'] = $post; $subjectTpl = $this->getTemplateFileManager()->getTemplate('mention', 'subject'); $bodyTpl = $this->getTemplateFileManager()->getTemplate('mention', 'body'); @@ -421,7 +423,10 @@ class EmailNotification extends \Espo\Core\Services\Base $data = []; $data['userName'] = $note->get('createdByName'); - $data['post'] = nl2br($note->get('post')); + + $post = $note->get('post') ?? ''; + $post = \Michelf\Markdown::defaultTransform($post); + $data['post'] = $post; if ($parentId && $parentType) { $parent = $this->getEntityManager()->getEntity($parentType, $parentId); diff --git a/composer.json b/composer.json index 4083b76514..dc9636ddc9 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,8 @@ "symfony/process": "4.1.7", "cboden/ratchet": "^0.4.1", "react/zmq": "^0.4.0", - "guzzlehttp/psr7": "^1.5" + "guzzlehttp/psr7": "^1.5", + "michelf/php-markdown": "^1.8" }, "autoload": { "psr-0": { diff --git a/composer.lock b/composer.lock index 1438b81bc8..07233a5cc5 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "74cd49fe4af7227fea87073f1e3f1868", - "content-hash": "6cd45f433252a420e8fb253822ff562b", + "hash": "0701d724bb88930ea650278c0cfcbb76", + "content-hash": "fdda0b39190cf8816d30f8a91337389a", "packages": [ { "name": "cboden/ratchet", @@ -730,6 +730,52 @@ ], "time": "2018-12-04 20:46:45" }, + { + "name": "michelf/php-markdown", + "version": "1.8.0", + "source": { + "type": "git", + "url": "https://github.com/michelf/php-markdown.git", + "reference": "01ab082b355bf188d907b9929cd99b2923053495" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/michelf/php-markdown/zipball/01ab082b355bf188d907b9929cd99b2923053495", + "reference": "01ab082b355bf188d907b9929cd99b2923053495", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Michelf\\": "Michelf/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Michel Fortin", + "email": "michel.fortin@michelf.ca", + "homepage": "https://michelf.ca/", + "role": "Developer" + }, + { + "name": "John Gruber", + "homepage": "https://daringfireball.net/" + } + ], + "description": "PHP Markdown", + "homepage": "https://michelf.ca/projects/php-markdown/", + "keywords": [ + "markdown" + ], + "time": "2018-01-15 00:49:33" + }, { "name": "monolog/monolog", "version": "1.20.0",