Skip to content

Unexpected discrepancy between renders of code-blocks and code-span #752

@ashmaroli

Description

@ashmaroli

Hi, the following discrepancy was detected while investigating jekyll/jekyll#8990

For context, Jekyll sets config["syntax_highlighter_opts"]["default_lang"] ||= "plaintext" prior to passing config onto kramdown.
With this set up, when Jekyll renders the following snippet:

This is a Ruby code fragment `x = Class.new`{:.language-ruby}

```
def what?
  42
end
```
{: .language-ruby}

into:

<p>This is a Ruby code fragment <code class="language-plaintext highlighter-rouge"><span class="n">x</span> <span class="o">=</span> <span class="no">Class</span><span class="p">.</span><span class="nf">new</span></code></p>

<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">def</span> <span class="nf">what?</span>
  <span class="mi">42</span>
<span class="k">end</span>
</code></pre></div></div>

Note how code-span gets language-plaintext assigned while the code-block gets language-ruby.

I'm not saying this is a bug with kramdown. But would like to get your opinion on the situation.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions