Skip to content

HTML classes being removed when specifying the language in inline code attributes #11423

@Polirecyliente

Description

@Polirecyliente

Explain the problem.
Good day team. There is an issue where HTML classes are being mistakenly removed when specifying the language in inline code attributes. I tested this compiling pandoc-cli on the tip commit of main, which at the moment of this writing is the commit with hash 675e0c450. Let me show you an example:

`def func1():`{.class1 .my-type .pristine .python}

How should this piece of Markdown be rendered as HTML? According to the manual, it should include at least the 4 classes: ".class1 .my-type .pristine .python", alas, it only contains 1 class, the language one: ".python". Here is how it looks on https://pandoc.org/try/

Image

If we now remove the language class ".python", then the other 3 classes do appear in the HTML representation as expected, you can see the 'class1' being highlighted on both the Markdown and HTML displays:

Image

Steps to replicate

  1. Run the following command:
pandoc -f markdown -t html
`def func1():`{.class1 .my-type .pristine .python}
^D

Observed behavior

This is the output received from that command, the three classes ".class1 .my-type .pristine" are missing:

<p><code
class="sourceCode python"><span class="kw">def</span> func1():</code></p>

Expected behavior

The three classes should appear in the ouput, potentially like the following:

<p><code
class="sourceCode python class1 my-type pristine"><span class="kw">def</span> func1():</code></p>

Pandoc version?
This was tested on the tip of the main branch, which is 675e0c450 (HEAD -> main, origin/main, origin/HEAD) MANUAL.txt: Small rewrite of syntax-highlighting info. at the moment of this writing.

Thank you for your attention to this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions