MarkdownDecorator: Don’t hard code line breaks (#77)

This patch makes MarkdownDecorator not include line breaks before and
after the `<pre>` and `<code>` tags that it adds to code blocks, since
this will be rendered as whitespace in the browser.
This commit is contained in:
John Sundell 2019-07-25 16:10:55 +02:00 committed by GitHub
parent 5280f4abc7
commit e107609b00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 9 deletions

View File

@ -38,9 +38,7 @@ public struct MarkdownDecorator {
}
output.append("""
<pre class="splash"><code>
\(code)
</code></pre>
<pre class="splash"><code>\(code)</code></pre>
""")
}

View File

@ -33,9 +33,7 @@ final class MarkdownTests: SplashTestCase {
Text text text `inline.code.shouldNotBeHighlighted()`.
<pre class="splash"><code>
<span class="keyword">struct</span> Hello: <span class="type">Protocol</span> {}
</code></pre>
<pre class="splash"><code><span class="keyword">struct</span> Hello: <span class="type">Protocol</span> {}</code></pre>
Text.
"""
@ -57,9 +55,7 @@ final class MarkdownTests: SplashTestCase {
let expectedResult = """
Text text.
<pre class="splash"><code>
struct Hello: Protocol {}
</code></pre>
<pre class="splash"><code>struct Hello: Protocol {}</code></pre>
Text.
"""