From e107609b00627952236082e2c98785020df869f0 Mon Sep 17 00:00:00 2001 From: John Sundell Date: Thu, 25 Jul 2019 16:10:55 +0200 Subject: [PATCH] =?UTF-8?q?MarkdownDecorator:=20Don=E2=80=99t=20hard=20cod?= =?UTF-8?q?e=20line=20breaks=20(#77)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch makes MarkdownDecorator not include line breaks before and after the `
` and `` tags that it adds to code blocks, since
this will be rendered as whitespace in the browser.
---
 Sources/Splash/Output/MarkdownDecorator.swift | 4 +---
 Tests/SplashTests/Tests/MarkdownTests.swift   | 8 ++------
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/Sources/Splash/Output/MarkdownDecorator.swift b/Sources/Splash/Output/MarkdownDecorator.swift
index 436f83e..fbda759 100644
--- a/Sources/Splash/Output/MarkdownDecorator.swift
+++ b/Sources/Splash/Output/MarkdownDecorator.swift
@@ -38,9 +38,7 @@ public struct MarkdownDecorator {
             }
 
             output.append("""
-            

-            \(code)
-            
+
\(code)
""") } diff --git a/Tests/SplashTests/Tests/MarkdownTests.swift b/Tests/SplashTests/Tests/MarkdownTests.swift index ed96f5e..5dcea50 100644 --- a/Tests/SplashTests/Tests/MarkdownTests.swift +++ b/Tests/SplashTests/Tests/MarkdownTests.swift @@ -33,9 +33,7 @@ final class MarkdownTests: SplashTestCase { Text text text `inline.code.shouldNotBeHighlighted()`. -

-        struct Hello: Protocol {}
-        
+
struct Hello: Protocol {}
Text. """ @@ -57,9 +55,7 @@ final class MarkdownTests: SplashTestCase { let expectedResult = """ Text text. -

-        struct Hello: Protocol {}
-        
+
struct Hello: Protocol {}
Text. """