# Fenced codeblocks with extra spaces at the end don't work?

**URL:** https://meta.discourse.org/t/fenced-codeblocks-with-extra-spaces-at-the-end-dont-work/48449
**Category:** Bug
**Tags:** markdown-it-review
**Created:** [August 10, 2016, 10:47am UTC](https://meta.discourse.org/t/fenced-codeblocks-with-extra-spaces-at-the-end-dont-work/48449 "2016-08-10T10:47:01Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![kuba-orlik](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kuba-orlik/32/318490_2.png) [@kuba-orlik](https://meta.discourse.org/u/kuba-orlik)
#### Post date: [August 10, 2016, 10:47am UTC](https://meta.discourse.org/t/fenced-codeblocks-with-extra-spaces-at-the-end-dont-work/48449/1 "2016-08-10T10:47:01Z")

</div>

Why doesn’t this code:

```plaintext
var www_server = Sealious.ChipManager.get_chip("channel", "www_server");

www_server.route({
    method: "GET",
    path: "/users.csv",
    handler: function(context, request){
      // .. logic goes here

```

preserve newlines? Did the syntax change or is there something I am missing?

---

<div class="post-metadata">

### Author: ![gkln](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gkln/32/293382_2.png) [@gkln](https://meta.discourse.org/u/gkln)
#### Post date: [August 10, 2016, 10:58am UTC](https://meta.discourse.org/t/fenced-codeblocks-with-extra-spaces-at-the-end-dont-work/48449/2 "2016-08-10T10:58:19Z")

</div>

You should encapsulate the code block with ``` instead of `.

```plaintext
var www_server = Sealious.ChipManager.get_chip("channel", "www_server");

www_server.route({
    method: "GET",
    path: "/users.csv",
    handler: function(context, request){
      // .. logic goes here

```

---

<div class="post-metadata">

### Author: ![kuba-orlik](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kuba-orlik/32/318490_2.png) [@kuba-orlik](https://meta.discourse.org/u/kuba-orlik)
#### Post date: [August 10, 2016, 11:34am UTC](https://meta.discourse.org/t/fenced-codeblocks-with-extra-spaces-at-the-end-dont-work/48449/3 "2016-08-10T11:34:07Z")

</div>

Please take a look at the source of my message: I _am_ using ```…

 ![](https://global.discourse-cdn.com/meta/original/3X/a/8/a84c7e10793c8d6d4c8569e56c5fcac99c80ba4c.png)

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [August 10, 2016, 11:35am UTC](https://meta.discourse.org/t/fenced-codeblocks-with-extra-spaces-at-the-end-dont-work/48449/4 "2016-08-10T11:35:00Z")

</div>

It seems to be the extra space after the closing ```

---

<div class="post-metadata">

### Author: ![kuba-orlik](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kuba-orlik/32/318490_2.png) [@kuba-orlik](https://meta.discourse.org/u/kuba-orlik)
#### Post date: [August 10, 2016, 1:00pm UTC](https://meta.discourse.org/t/fenced-codeblocks-with-extra-spaces-at-the-end-dont-work/48449/5 "2016-08-10T13:00:24Z")

</div>

I see, removing the redundant space does fix the issue.

But It’s not CommonMark compliant, right? When I pasted the code [here] it behaved as it should.

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [August 10, 2016, 1:12pm UTC](https://meta.discourse.org/t/fenced-codeblocks-with-extra-spaces-at-the-end-dont-work/48449/6 "2016-08-10T13:12:26Z")

</div>

Discourse isn’t using CommonMark yet (to my knowledge) so if it works at [commonmark.js demo](http://spec.commonmark.org/dingus/), when Discourse switches to CommonMark, it should resolve itself.

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [August 10, 2016, 2:45pm UTC](https://meta.discourse.org/t/fenced-codeblocks-with-extra-spaces-at-the-end-dont-work/48449/7 "2016-08-10T14:45:48Z")

</div>

Yes I can confirm we’re note on CommonMark yet. In 1.6 I did a lot of work to convert our existing markdown to ES6 so that we could try plugging in a different engine and see how well it works.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [June 26, 2017, 2:04pm UTC](https://meta.discourse.org/t/fenced-codeblocks-with-extra-spaces-at-the-end-dont-work/48449/8 "2017-06-26T14:04:12Z")

</div>

Rebaked OP and all seems fine

```plaintext
trailing spaces 
no 
longer 
break this

```

> [@CommonMark testing started here!](https://meta.discourse.org/t/commonmark-testing-started-here/65121):
>
> Per our [migration plans](https://meta.discourse.org/t/discourse-commonmark-migration-plans-confetti-ball-balloon), I just enabled [markdown.it](https://github.com/markdown-it/markdown-it) at Meta. It is an excellent [CommonMark](http://commonmark.org/) compliant engine. I expect quite a few edges to be found during this period of testing. Do not open bugs about the new Engine, just reply here. I/we will be updating the top post here with the list of issues and striking out stuff as it is fixed. Current known issues (to be fixed)white_check_mark Onebox vanishes after you start typing and works not-super consistently white_check_mark pending…

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [June 26, 2017, 2:04pm UTC](https://meta.discourse.org/t/fenced-codeblocks-with-extra-spaces-at-the-end-dont-work/48449/9 "2017-06-26T14:04:19Z")

</div>


