# Code fences inside a list render as one line

**URL:** https://meta.discourse.org/t/code-fences-inside-a-list-render-as-one-line/32445
**Category:** Bug
**Tags:** composer
**Created:** [8월 23, 2015, 10:52오후 UTC](https://meta.discourse.org/t/code-fences-inside-a-list-render-as-one-line/32445 "2015-08-23T22:52:35Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![clay](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/clay/32/102156_2.png) [@clay](https://meta.discourse.org/u/clay)
#### Post date: [8월 23, 2015, 10:52오후 UTC](https://meta.discourse.org/t/code-fences-inside-a-list-render-as-one-line/32445/1 "2015-08-23T22:52:35Z")

</div>

While testing another bug, I posted this text to [try.discourse.org](http://try.discourse.org):

[problem\_post.txt](https://global.discourse-cdn.com/meta/original/3X/e/8/e88b2899dc1fc9796ca2157fa63fac4ecadaf56c.txt) (2.5 KB)

The editor preview shows line breaks in the code block, but the post itself renders without the line breaks.

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

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [8월 23, 2015, 11:02오후 UTC](https://meta.discourse.org/t/code-fences-inside-a-list-render-as-one-line/32445/2 "2015-08-23T23:02:56Z")

</div>

This can happens when an invalid language keyword is used, let’s see

line above

```bleh
size(600, 400);
println("width " + width);
println("height " + height);

```

versus

line above

```plaintext
size(600, 400);
println("width " + width);
println("height " + height);

```

````
line above
``` bleh
size(600, 400);
println("width " + width);
println("height " + height);
```

versus

line above
```
size(600, 400);
println("width " + width);
println("height " + height);
```

````

---

<div class="post-metadata">

### Author: ![clay](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/clay/32/102156_2.png) [@clay](https://meta.discourse.org/u/clay)
#### Post date: [8월 23, 2015, 11:08오후 UTC](https://meta.discourse.org/t/code-fences-inside-a-list-render-as-one-line/32445/4 "2015-08-23T23:08:39Z")

</div>

The code seems to work fine when it is not nested under a bullet.

1. Some list

2. Another list item

versus…

```plaintext
size(100,100);
ellipse(x,y,100,100);

```

---

<div class="post-metadata">

### Author: ![johnmuhl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johnmuhl/32/43413_2.png) [@johnmuhl](https://meta.discourse.org/u/johnmuhl)
#### Post date: [8월 23, 2015, 11:37오후 UTC](https://meta.discourse.org/t/code-fences-inside-a-list-render-as-one-line/32445/5 "2015-08-23T23:37:42Z")

</div>

It’s the backtick code blocks inside list which are not standardized across implementations (the preview and output differing seems like a real bug though). But you can use indented code blocks as a workaround until Discourse switches to markdown-it (which supports what you are trying to do).

```plaintext
1. first

        size(x, y);
        print(1);

2. second

        size(x, y);
        print(1);

3. third
4. and so on

```

1. first

2. second

3. third

4. and so on

---

<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: [8월 24, 2015, 8:31오후 UTC](https://meta.discourse.org/t/code-fences-inside-a-list-render-as-one-line/32445/6 "2015-08-24T20:31:49Z")

</div>

Thanks I’ve fixed this in master (it’s currently being deployed):

[https://github.com/discourse/discourse/commit/f2db4bfcf3ee6dc024ef1bee91acf66049753501](https://github.com/discourse/discourse/commit/f2db4bfcf3ee6dc024ef1bee91acf66049753501)

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [8월 24, 2015, 9:43오후 UTC](https://meta.discourse.org/t/code-fences-inside-a-list-render-as-one-line/32445/7 "2015-08-24T21:43:12Z")

</div>


