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

Preserve trailing newlines in code fences #1011

Merged
merged 1 commit into from
Jan 12, 2018

Conversation

Feder1co5oave
Copy link
Contributor

@Feder1co5oave Feder1co5oave commented Jan 12, 2018

This fixes #645 and fixes #931.

Preserve trailing newlines in code fence per commonmark spec.

```js
ciao();


```

becomes

<pre><code class="lang-js">ciao();


</code></pre>

This includes tests, which are not useful since whitespace is not checked for in our test routine. (Might need to fix this too)

@joshbruce joshbruce merged commit 3668af8 into markedjs:master Jan 12, 2018
@joshbruce
Copy link
Member

LGTM!

@joshbruce joshbruce added this to the 0.4.0 - No known defects milestone Jan 12, 2018
@Feder1co5oave Feder1co5oave deleted the fix-645 branch January 15, 2018 01:12
zhenalexfan pushed a commit to zhenalexfan/MarkdownHan that referenced this pull request Nov 8, 2021
Preserve trailing newlines in code fences
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issue: when parsing code to <pre>, \n at the end lost Preserve new lines (\n) within a <code> block
2 participants