From 6ab2593530b1e8addc804be497d1972b46a934fa Mon Sep 17 00:00:00 2001 From: Remy Rylan Date: Fri, 11 May 2018 11:20:29 -0400 Subject: [PATCH] Remove extra inner linebreak from code blocks --- lib/marked.js | 4 ++-- test/new/cm_blockquotes.html | 18 ++++++------------ 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/lib/marked.js b/lib/marked.js index 83974865e4..b929ffb5d4 100644 --- a/lib/marked.js +++ b/lib/marked.js @@ -889,7 +889,7 @@ Renderer.prototype.code = function(code, lang, escaped) { if (!lang) { return '
'
       + (escaped ? code : escape(code, true))
-      + '\n
'; + + ''; } return '
'
     + (escaped ? code : escape(code, true))
-    + '\n
\n'; + + '\n'; }; Renderer.prototype.blockquote = function(quote) { diff --git a/test/new/cm_blockquotes.html b/test/new/cm_blockquotes.html index 363f4e218a..f63e5e0067 100644 --- a/test/new/cm_blockquotes.html +++ b/test/new/cm_blockquotes.html @@ -32,8 +32,7 @@

Example 194

> # Foo
 > bar
-> baz
-
+> baz

Example 195

@@ -78,11 +77,9 @@

Example 199

For the same reason, we can’t omit the > in front of subsequent lines of an indented or fenced code block:

-
foo
-
+
foo
-
bar
-
+
bar

Example 200

@@ -94,8 +91,7 @@

Example 200

<pre><code></code></pre> </blockquote> <p>foo</p> -<pre><code></code></pre> - +<pre><code></code></pre>

Example 201

> foo
@@ -104,8 +100,7 @@ 

Example 201

<blockquote> <p>foo - bar</p> -</blockquote> -
+</blockquote>

Example 202

@@ -231,8 +226,7 @@

Example 215

When including an indented code block in a block quote, remember that the block quote marker includes both the > and a following space. So five spaces are needed after the >:

-
code
-
+
code

not code