valeriangalliat / markdown-it-highlightjs

Preset to use highlight.js with markdown-it.
The Unlicense
58 stars 31 forks source link

Doesn't add `hljs` class to inline code #25

Closed Maxim-Mazurok closed 2 years ago

Maxim-Mazurok commented 2 years ago

I see this in most themes:

code.hljs {
  padding: 3px 5px;
}

And I see similar thing for inline code on github:

.markdown-body code{
    padding: 0.2em 0.4em;
}

and on SO:

.s-prose *:not(.s-code-block)>code {
    padding: 2px 4px;

So I'm guessing that idea in highlights is that this padding is supposed to be added to inline code. But this class hljs is not being added :( Would be great to add it. Thanks!

valeriangalliat commented 2 years ago

Good catch! I think it's potentially breaking if people expected the hljs class to not be present, so I bumped a major, v4.0.0 (actually needs to be v4.0.1 because of a publish mistake) that now sets hljs on inline code class. Cheers :)