Fixes to html/markdown parsing

This commit is contained in:
Daniil Gentili 2017-02-18 17:32:08 +01:00
parent 3ceb34c3b0
commit 8ff7c68a55

View File

@ -636,14 +636,14 @@ trait TL
public function parse_mode($arguments)
{
if (preg_match('/markdown/i', $arguments['parse_mode'])) {
$arguments['message'] = str_replace("\n", '', \Parsedown::instance()->line($arguments['message']));
$arguments['message'] = \Parsedown::instance()->line($arguments['message']);
$arguments['parse_mode'] = 'HTML';
}
if (preg_match('/html/i', $arguments['parse_mode'])) {
$nmessage = '';
try {
$dom = new \DOMDocument();
$dom->loadHTML(str_replace("\n", '<br>', $arguments['message']));
$dom->loadHTML($arguments['message']);
if (!isset($arguments['entities'])) {
$arguments['entities'] = [];
}