Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

render code with and without language with the trailing newline #1670

Merged
merged 1 commit into from May 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Renderer.js
Expand Up @@ -25,7 +25,7 @@ module.exports = class Renderer {
if (!lang) {
return '<pre><code>'
+ (escaped ? code : escape(code, true))
+ '</code></pre>';
+ '</code></pre>\n';
}

return '<pre><code class="'
Expand Down
3 changes: 2 additions & 1 deletion test/specs/new/code_compensation_indent.html
Expand Up @@ -2,5 +2,6 @@
<ol>
<li><p>This is a list element.</p>
<pre><code>const x = 5;
const y = x + 5;</code></pre></li>
const y = x + 5;</code></pre>
</li>
</ol>
3 changes: 3 additions & 0 deletions test/specs/new/code_consistent_newline.html
@@ -0,0 +1,3 @@
<pre><code class="language-js">const value = 42;</code></pre>
<pre><code>const value = 42;</code></pre>
<p>Code blocks contain trailing new line.</p>
10 changes: 10 additions & 0 deletions test/specs/new/code_consistent_newline.md
@@ -0,0 +1,10 @@
---
renderExact: true
---
```js
const value = 42;
```

const value = 42;

Code blocks contain trailing new line.