# Fenced code block with lang hint breaks subsequent formatting

**URL:** https://meta.discourse.org/t/fenced-code-block-with-lang-hint-breaks-subsequent-formatting/54020
**Category:** Bug
**Tags:** markdown-it-review
**Created:** [12월 9, 2016, 3:26오후 UTC](https://meta.discourse.org/t/fenced-code-block-with-lang-hint-breaks-subsequent-formatting/54020 "2016-12-09T15:26:02Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Patrick\_David](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/patrick_david/32/119657_2.png) [@Patrick\_David](https://meta.discourse.org/u/Patrick_David)
#### Post date: [12월 9, 2016, 3:26오후 UTC](https://meta.discourse.org/t/fenced-code-block-with-lang-hint-breaks-subsequent-formatting/54020/1 "2016-12-09T15:26:02Z")

</div>

A test [google link](http://www.gooogle.com) and some **simple** _formatting_.

A fenced code block, with language set to `C++` ( ````C++`):

```C++
#include "MIDIUSB.h"

#define ENCODER_PIN_A A3
#define ENCODER_PIN_B A2
#define NUMBER_CLICKS 30 // the number of clicks per rotation of the encoder

#define SLIDER_PIN A1
#define SLIDER_MAX 1015 // my fader has a tiny resistance when completely open

unsigned long loopTime;
uint8_t encoder_state_prev;
uint8_t encoder_pos_prev = 0;
uint8_t slider_7bit_prev = 0;

```

A test [google link](http://www.gooogle.com) and some **simple** _formatting_.

A new paragraph.

Another fenced code block:

```plaintext
test

```

_If_ you are seeing raw markdown above the `test` code block, something is amiss. 🙂

Changing the language for the first fenced code block to `cpp` or leaving it blank fixes the problem, but using `C++` or `c++` both cause it to happen, which is odd if we’re still using highlight.js because it seems to indicate that it _should_ work?

> <https://github.com/highlightjs/highlight.js/blob/main/src/languages/cpp.js#L100>

This _seems_ possibly related to this topic:

> [@Certain info strings on fenced code blocks break formatting between the blocks](https://meta.discourse.org/t/certain-info-strings-on-fenced-code-blocks-break-formatting-between-the-blocks/42467):
>
> I just encountered a bug while I was writing a post on a Discourse-powered forum and would like to report it. It seems like if I have two fenced code blocks with an info string of “{.cpp}”, where each block starts with a line equal to “```{.cpp}” and ends with a line equal to “```”, then any text formatting between the two blocks of code does not work at all, and we see the markup instead of seeing nicely-formatted text. See below for an example: // Here is a block of C++ code. For some reas…

Though in this case I’m not using curly braces, but normal (I _think_ markdown compliant fenced blocks).

Here is a gist with the top part of this post (apparently working ok on github):

> <https://gist.github.com/patdavid/6d4598267b19ff794ba4746668501f3e>

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [12월 9, 2016, 4:27오후 UTC](https://meta.discourse.org/t/fenced-code-block-with-lang-hint-breaks-subsequent-formatting/54020/2 "2016-12-09T16:27:22Z")

</div>

For me this is a definitive duplicate of the topic you linked.

All bugs of this category are being postponed, and will be revisited when the switch to markdown-it happens, because [it fixes it](https://markdown-it.github.io/#md3=%7B%22source%22%3A%22example%3A%5Cn%5Cn%60%60%60%7B.cpp%7D%5Cn%2F%2F%20Here%20is%20a%20block%20of%20C%2B%2B%20code.%5Cn%60%60%60%5Cn%5CnFor%20some%20reason%20we%20cannot%20have%20%60monospace%60%2C%20_italic_%2C%20%2A%2Abold%2A%2A%2C%20or%20%5Blink%5D%28https%3A%2F%2Fexample.com%29%20text%20in%20this%20paragraph%2C%20which%20is%20between%20two%20blocks%20of%20C%2B%2B%20code.%20%20In%20fact%2C%20I%20can%27t%20find%20any%20other%20Markdown%2C%20BBCode%2C%20or%20HTML%20that%20does%20work%20in%20this%20area.%5Cn%5CnWe%20can%27t%20even%20have%20multiple%20paragraphs.%5Cn%5Cn%60%60%60%7B.cpp%7D%5Cn%2F%2F%20Here%20is%20a%20second%20block%20of%20C%2B%2B%20code.%5Cn%60%60%60%22%2C%22defaults%22%3A%7B%22html%22%3Afalse%2C%22xhtmlOut%22%3Afalse%2C%22breaks%22%3Afalse%2C%22langPrefix%22%3A%22language-%22%2C%22linkify%22%3Atrue%2C%22typographer%22%3Atrue%2C%22_highlight%22%3Atrue%2C%22_strict%22%3Afalse%2C%22_view%22%3A%22html%22%7D%7D).

---

<div class="post-metadata">

### Author: ![Patrick\_David](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/patrick_david/32/119657_2.png) [@Patrick\_David](https://meta.discourse.org/u/Patrick_David)
#### Post date: [12월 9, 2016, 4:39오후 UTC](https://meta.discourse.org/t/fenced-code-block-with-lang-hint-breaks-subsequent-formatting/54020/3 "2016-12-09T16:39:53Z")

</div>

Thank you for the heads up! I’ll wait for the markdown-it switch. 🙂

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [12월 9, 2016, 7:30오후 UTC](https://meta.discourse.org/t/fenced-code-block-with-lang-hint-breaks-subsequent-formatting/54020/4 "2016-12-09T19:30:36Z")

</div>

This topic was automatically closed after 3 hours. New replies are no longer allowed.
