# Certain info strings on fenced code blocks break formatting between the blocks

**URL:** <https://meta.discourse.org/t/certain-info-strings-on-fenced-code-blocks-break-formatting-between-the-blocks/42467>\
**Category:** Bug\
**Tags:** markdown-it-review\
**Created:** [Avril 12, 2016, 7:09 UTC](https://meta.discourse.org/t/certain-info-strings-on-fenced-code-blocks-break-formatting-between-the-blocks/42467 "2016-04-12T19:09:16Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![DavidEGrayson](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/davidegrayson/32/120237_2.png) [@DavidEGrayson](https://meta.discourse.org/u/DavidEGrayson)\
**Post date:** [Avril 13, 2016, 1:08 UTC](https://meta.discourse.org/t/certain-info-strings-on-fenced-code-blocks-break-formatting-between-the-blocks/42467/4 "2016-04-13T01:08:32Z")

</div>

Hi @codinghorror! I’m not sure, but I think I started using info strings like `{.cpp}` several years ago because the [Doxygen manual’s section about markdown support](https://www.stack.nl/~dimitri/doxygen/manual/markdown.html) has examples of fenced code blocks that show it that way.

Before starting this topic, I tried to look around for Discourse documentation or documentation on [http://commonmark.org/](http://commonmark.org/) that would tell me what the correct info string is for C++, but I couldn’t find the right documentation. So I tried to guess what the info string might be. When I changed the info string from “{.cpp}” to “cpp”, I saw that class names in my example code ceased to be highlighted, so I thought that “cpp” wasn’t correct. However, since @sam says that “cpp” is correct then I suppose it is. Thanks, @sam!

```plaintext
// If we use no info string or {.cpp}, the class name gets highlighted.
// I'm not sure what language Discourse has guessed here.
class Example {
  void foo();
  virtual ~Example();
};

```

```cpp
// If we use "cpp", the class name is not highlighted. 
class Example {
  void foo();
  virtual ~Example();
};

```

So, practically, this problem is solved. 🙂

However, isn’t it fair to say that my original post is rendered incorrectly by Discourse? The paragraph I tried to put between the two code blocks is not formatted as code and it’s not formatted as normal text, so that seems weird to me. The [CommonMark Spec 0.24](http://spec.commonmark.org/0.24/) defines [info strings](http://spec.commonmark.org/0.24/#info-string) like this:

> The line with the opening code fence may optionally contain some text following the code fence; this is trimmed of leading and trailing spaces and called the **info string**. The info string may not contain any backtick characters. (The reason for this restriction is that otherwise some inline code would be incorrectly interpreted as the beginning of a fenced code block.)  
> …  
> The first word of the info string is typically used to specify the language of the code sample, and rendered in the class attribute of the code tag. However, this spec does not mandate any particular treatment of the info string.

I don’t really see why an info string with period or bracket characters should affect other paragraphs in the document that are outside of the fenced code block and make them render in a weird way. An info string with periods and brackets seems to be an acceptable part of Markdown, or am I missing something?

---

_[View the full topic](https://meta.discourse.org/t/certain-info-strings-on-fenced-code-blocks-break-formatting-between-the-blocks/42467)._
