Skip to content

Do not add the language- prefix when the info string already starts with language- #277

Description

@ThomasSoeiro

commonmark.js adds a language- prefix to the info string provided after the opening code fence, regardless if it already starts with language-.

Could commonmark.js not adding the language- prefix in this case to allow using the language- prefix in the source whitout resulting in language-language-infostring in html?

E.g., using the following source:

```language-r
x <- 1
```

```r
x <- 1
```

We get the following result:

<pre><code class="language-language-r">x &lt;- 1
</code></pre>
<pre><code class="language-r">x &lt;- 1
</code></pre>

The commonmark spec currently says that it "does not mandate any particular treatment of the info string". A language- prefix is added in example 142.

With pandoc --from commonmark --to html5 --no-highlight, we get:

<pre class="language-r"><code>x &lt;- 1</code></pre>
<pre class="r"><code>x &lt;- 1</code></pre>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions