Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ThomasSoeiro opened this issue Jan 22, 2024 · 2 comments

Comments

@ThomasSoeiro
Copy link

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>
@jgm jgm closed this as completed in c7aef33 Jan 22, 2024
jgm added a commit to commonmark/cmark that referenced this issue Jan 22, 2024
@ThomasSoeiro
Copy link
Author

@jgm

Thanks for the fix!

BTW, would you mind releasing a new version? There have been some useful fixes since the last stable release.

@jgm
Copy link
Member

jgm commented Jan 23, 2024

The changes include changes to spec.txt, so we'd need to do a new release of the spec as well. Should probably do that, but this is just to let you know why it isn't a trivial thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants