valeriangalliat / markdown-it-highlightjs

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

Inline language breaks with markdown-it-attrs #24

Closed Maxim-Mazurok closed 2 years ago

Maxim-Mazurok commented 2 years ago

I am using https://www.npmjs.com/package/markdown-it-attrs and it broke the inline language feature:

`alert("Dog")`{:.js}

I tried to put highlights before attrs - didn't help.

This helped:

.use(markdownItAttrs, {
  leftDelimiter: '{attrs=',
  rightDelimiter: '=attrs}',
})
valeriangalliat commented 2 years ago

Interesting, yeah it looks like markdown-it-attrs syntax somewhat conflicts with Pandoc and kramdown syntax for inline code language.

I refactored a bunch of things in v4.0.0 and I made sure to parse the inline code language at an earlier parsing step (originally I was doing it at the render step), so that we can get a chance to parse it before markdown-it-attrs.

So in v4.0.0 you can include markdown-it-highlightjs before markdown-it-attrs and it'll work just as you expected!