From 782c7e7d1b8dfc00e44e645fed427ee6667a9551 Mon Sep 17 00:00:00 2001 From: Olli Vesslin Date: Thu, 25 Aug 2022 09:48:11 +0300 Subject: [PATCH] #226: Escape setext heading underlines. --- src/Converter/ParagraphConverter.php | 1 + tests/HtmlConverterTest.php | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Converter/ParagraphConverter.php b/src/Converter/ParagraphConverter.php index 65b37a4..4246d16 100644 --- a/src/Converter/ParagraphConverter.php +++ b/src/Converter/ParagraphConverter.php @@ -56,6 +56,7 @@ private function escapeFirstCharacters(string $line): string '~~~', '---', '- - -', + '=', ]; foreach ($escapable as $i) { diff --git a/tests/HtmlConverterTest.php b/tests/HtmlConverterTest.php index 64b9086..ed1e326 100644 --- a/tests/HtmlConverterTest.php +++ b/tests/HtmlConverterTest.php @@ -401,6 +401,7 @@ public function testSanitization(): void $this->assertHtmlGivesMarkdown($html, $markdown); $this->assertHtmlGivesMarkdown('

> > Look at me! < <

', '> > Look at me! < <'); $this->assertHtmlGivesMarkdown('

> > Look at me! < <
> Just look at me!

', "> > **Look** at me! < < \n> Just look at me!"); + $this->assertHtmlGivesMarkdown('

Foo
=
Bar

', "Foo \n\\= \nBar"); $this->assertHtmlGivesMarkdown('

Foo
--
Bar
Foo--

', "Foo \n\\-- \nBar \nFoo--"); $this->assertHtmlGivesMarkdown('', "- Foo \n \\- Bar"); $this->assertHtmlGivesMarkdown('Foo
* Bar', "Foo \n\\* Bar");