diff --git a/CHANGELOG.md b/CHANGELOG.md index fbf1a3047..6c9a53e30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,8 +9,9 @@ Features: Fixes: - Improved the `markdownEscape` function! - Translated even more MadelineProto UI elements! -- Now the same static analysis rules are applied for both plugins and simple event handlers. +- Improve the static analyzer. - Made some fixes to simple filters. +- Relax markdown parser. --- diff --git a/src/TL/Conversion/MarkdownEntities.php b/src/TL/Conversion/MarkdownEntities.php index c1fec7def..304c75397 100644 --- a/src/TL/Conversion/MarkdownEntities.php +++ b/src/TL/Conversion/MarkdownEntities.php @@ -79,7 +79,10 @@ final class MarkdownEntities extends Entities continue; } if ($next !== '(') { - throw new AssertionError("( expected @ pos $offset!"); + [, $start] = \array_pop($stack); + $message .= '['.$piece.$char; + $messageLen += StrTools::mbStrlen($piece)+2; + continue; } $offset++; $char = "]("; diff --git a/tests/danog/MadelineProto/EntitiesTest.php b/tests/danog/MadelineProto/EntitiesTest.php index fdb7a5340..5a62fb27b 100644 --- a/tests/danog/MadelineProto/EntitiesTest.php +++ b/tests/danog/MadelineProto/EntitiesTest.php @@ -349,6 +349,12 @@ class EntitiesTest extends MadelineTestCase ], ], ], + [ + 'markdown', + '[not a link]', + '[not a link]', + [], + ], [ 'html', 'link test',