# Discourse Mangling Text in a Code Block

**URL:** https://meta.discourse.org/t/discourse-mangling-text-in-a-code-block/31935
**Category:** Bug
**Tags:** markdown-it-review
**Created:** [August 9, 2015, 8:48pm UTC](https://meta.discourse.org/t/discourse-mangling-text-in-a-code-block/31935 "2015-08-09T20:48:50Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![ccstone](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ccstone/32/140215_2.png) [@ccstone](https://meta.discourse.org/u/ccstone)
#### Post date: [August 9, 2015, 8:48pm UTC](https://meta.discourse.org/t/discourse-mangling-text-in-a-code-block/31935/1 "2015-08-09T20:48:50Z")

</div>

Hey Folks,

I’m posting AppleScript on the Keyboard Maestro forum using a code-block.

A user reported a compile problem with my code.

Rendered by Discourse:

```plaintext
set foundList to cng("<td class=\"pricesens\">.+title=[[:punct:]](price sensitive)[[:punct:]]>", "\\1", foundList) of me

```

What should be:

Double-Quote-Backslash-Backslash-1-Double-Quote

Is rendering as:

Double-Quote-Backslash-BackTick-Double-Quote.

`“\\1”`

Using a `<code></code>` block on the forum I can get the few characters above to show up correctly by adding a backslash, but it the code-block doesn’t like my complete line of code.

Using `<pre></pre>` tags doesn’t help on the forum, although it works perfectly well in a normal html page.

Code-blocks should be completely unadulterated, so I conclude this is a bug.

–  
Regards,  
Christopher Stone

---

<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: [August 9, 2015, 9:48pm UTC](https://meta.discourse.org/t/discourse-mangling-text-in-a-code-block/31935/2 "2015-08-09T21:48:54Z")

</div>

Seems like a bug, yes:

Indented 4 spaces

```
set foundList to cng("<td class=\"pricesens\">.+title=[[:punct:]](price sensitive)[[:punct:]]>", "\\1", foundList) of me

```

As a code block

`set foundList to cng("<td class=\"pricesens\">.+title=[[:punct:]](price sensitive)[[:punct:]]>", "\\1", foundList) of me`

The two backslashes in front of the 1 are not rendering correctly. You could try it on Babelmark as well…

---

<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: [August 9, 2015, 11:30pm UTC](https://meta.discourse.org/t/discourse-mangling-text-in-a-code-block/31935/3 "2015-08-09T23:30:58Z")

</div>

Minimal repro

```plaintext
\\1

```

`\\1`

```plaintext
\\1
```

```
\\1

```

Broken in all code version.

---

<div class="post-metadata">

### Author: ![ccstone](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ccstone/32/140215_2.png) [@ccstone](https://meta.discourse.org/u/ccstone)
#### Post date: [August 23, 2016, 3:49pm UTC](https://meta.discourse.org/t/discourse-mangling-text-in-a-code-block/31935/4 "2016-08-23T15:49:47Z")

</div>

Hey Folks,

This bug is still not fixed.

Code rendering needs to be bombproof reliable…

-Chris

---

<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 23, 2016, 4:12pm UTC](https://meta.discourse.org/t/discourse-mangling-text-in-a-code-block/31935/5 "2016-08-23T16:12:10Z")

</div>

They aren’t on commonmark yet, and this is tagged to be reviewed when they move to it.

---

<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, 8:10pm UTC](https://meta.discourse.org/t/discourse-mangling-text-in-a-code-block/31935/6 "2017-06-26T20:10:16Z")

</div>

And … it now works!

```plaintext
\\1

```

`\\1`

```
\\1

```

Yay

````
```
\\1
```

`\\1`

    \\1

````

It will take a bit till this is rolled out but new engine fixes it:

> [@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, 8:10pm UTC](https://meta.discourse.org/t/discourse-mangling-text-in-a-code-block/31935/7 "2017-06-26T20:10:22Z")

</div>


