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:
parent
5280f4abc7
commit
e107609b00
@ -38,9 +38,7 @@ public struct MarkdownDecorator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
output.append("""
|
output.append("""
|
||||||
<pre class="splash"><code>
|
<pre class="splash"><code>\(code)</code></pre>
|
||||||
\(code)
|
|
||||||
</code></pre>
|
|
||||||
""")
|
""")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,9 +33,7 @@ final class MarkdownTests: SplashTestCase {
|
|||||||
|
|
||||||
Text text text `inline.code.shouldNotBeHighlighted()`.
|
Text text text `inline.code.shouldNotBeHighlighted()`.
|
||||||
|
|
||||||
<pre class="splash"><code>
|
<pre class="splash"><code><span class="keyword">struct</span> Hello: <span class="type">Protocol</span> {}</code></pre>
|
||||||
<span class="keyword">struct</span> Hello: <span class="type">Protocol</span> {}
|
|
||||||
</code></pre>
|
|
||||||
|
|
||||||
Text.
|
Text.
|
||||||
"""
|
"""
|
||||||
@ -57,9 +55,7 @@ final class MarkdownTests: SplashTestCase {
|
|||||||
let expectedResult = """
|
let expectedResult = """
|
||||||
Text text.
|
Text text.
|
||||||
|
|
||||||
<pre class="splash"><code>
|
<pre class="splash"><code>struct Hello: Protocol {}</code></pre>
|
||||||
struct Hello: Protocol {}
|
|
||||||
</code></pre>
|
|
||||||
|
|
||||||
Text.
|
Text.
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user