From 6504156508615a855ef3f582191b4b82147a7231 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Wed, 9 Aug 2017 16:04:53 +0200 Subject: [PATCH] add a switch to the Markdown parser for using hard line breaks (issue 3592) --- library/markdown.php | 29 +++++++++++++++++++++++++++-- mod/admin.php | 4 ++-- mod/help.php | 4 ++-- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/library/markdown.php b/library/markdown.php index 769bdb121..61eb5951c 100644 --- a/library/markdown.php +++ b/library/markdown.php @@ -1,14 +1,39 @@ hard_wrap = true; + if ($hardbreak) { + $MarkdownParser->hard_wrap = true; + } else { + $MarkdownParser->hard_wrap = false; + } $html = $MarkdownParser->transform($text); $a->save_timestamp($stamp1, "parser"); diff --git a/mod/admin.php b/mod/admin.php index e59baaa1d..90bc8c0fc 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -1687,7 +1687,7 @@ function admin_page_plugins(App $a) { $readme=Null; if (is_file("addon/$plugin/README.md")) { $readme = file_get_contents("addon/$plugin/README.md"); - $readme = Markdown($readme); + $readme = Markdown($readme, false); } elseif (is_file("addon/$plugin/README")) { $readme = "
". file_get_contents("addon/$plugin/README") ."
"; } @@ -1939,7 +1939,7 @@ function admin_page_themes(App $a) { $readme = Null; if (is_file("view/theme/$theme/README.md")) { $readme = file_get_contents("view/theme/$theme/README.md"); - $readme = Markdown($readme); + $readme = Markdown($readme, false); } elseif (is_file("view/theme/$theme/README")) { $readme = "
". file_get_contents("view/theme/$theme/README") ."
"; } diff --git a/mod/help.php b/mod/help.php index 1d5c831ef..95fe91c38 100644 --- a/mod/help.php +++ b/mod/help.php @@ -49,7 +49,7 @@ function help_content(App $a) { $filename = "Home"; $a->page['title'] = t('Help'); } else { - $a->page['aside'] = Markdown($home); + $a->page['aside'] = Markdown($home, false); } if (!strlen($text)) { @@ -60,7 +60,7 @@ function help_content(App $a) { )); } - $html = Markdown($text); + $html = Markdown($text, false); if ($filename !== "Home") { // create TOC but not for home