Skip to content
Browse files

Fix for linebreak support in Markdown

  • Loading branch information...
1 parent 70f7638 commit 27a5b3f0f236c4258d573bfa6ef2885320a59cc3 @kolber committed Apr 4, 2013
Showing with 5 additions and 2 deletions.
  1. +5 −2 app/parsers/markdown-parser.inc.php
View
7 app/parsers/markdown-parser.inc.php
@@ -6,6 +6,9 @@
# Copyright (c) 2004-2009 Michel Fortin
# <http://michelf.com/projects/php-markdown/>
#
+# Modified to preserve line breaks, line #667
+# <http://stackoverflow.com/questions/2092966/how-to-treat-single-newline-as-real-line-break-in-php-markdown>
+#
# Original Markdown
# Copyright (c) 2004-2006 John Gruber
# <http://daringfireball.net/projects/markdown/>
@@ -661,7 +664,7 @@ function runSpanGamut($text) {
function doHardBreaks($text) {
# Do hard breaks:
- return preg_replace_callback('/ {2,}\n/',
+ return preg_replace_callback('/ {2,}\n|\n{1}/',
array(&$this, '_doHardBreaks_callback'), $text);
}
function _doHardBreaks_callback($matches) {
@@ -2929,4 +2932,4 @@ function _doAbbreviations_callback($matches) {
software, even if advised of the possibility of such damage.
*/
-?>
+?>

0 comments on commit 27a5b3f

Please sign in to comment.
Something went wrong with that request. Please try again.