From 0346416ae81dbbd3532af8cc7d46ac25f9591b73 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Mon, 30 May 2022 12:09:00 +0200 Subject: [PATCH] Flarum: Strip `>` in front of code blocks This avoids a rendering issue with Parsedown, which would strip the indentation in the code block, possibly breaking YAML et al. --- files/lib/system/exporter/Flarum1xExporter.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/files/lib/system/exporter/Flarum1xExporter.class.php b/files/lib/system/exporter/Flarum1xExporter.class.php index 13f8d82..c309d23 100644 --- a/files/lib/system/exporter/Flarum1xExporter.class.php +++ b/files/lib/system/exporter/Flarum1xExporter.class.php @@ -710,6 +710,8 @@ final class Flarum1xExporter extends AbstractExporter // Unparser::unparse() $message = \html_entity_decode(\strip_tags($message), ENT_QUOTES, 'UTF-8'); + $message = \preg_replace('/(^|\n)> (```)/', '\\1\\2', $message); + $out = $parsedown->text($message); $out = \preg_replace( -- 2.20.1