In short, downlit is doing the highlighting instead of Pandoc but applies the classes expected by Pandoc. However the resulting structure is different, and this conflict with the CSS inserted by Pandoc. Especially, Pandoc's expect Div > pre > code > on span by line of code > spans for highlighted element.
the display inline-block is causing formatting issue;
it should apply on <span> after <code> only, which are supposed to be the spans for each line, and not the ones holding the highlighting classes.
I could probably deal with that on a per-format basis, to tweak the CSS, but this will need to be done with any HTML format that uses Pandoc's CSS.
It seems last changed in evaluate_and_highlight() from https://github.com/r-lib/downlit/pull/96 will add a span for each line of a class r-in. This would be compatible with Pandoc.
There is also a probabily that downlit support in distill should be done differently that it is now. It was done early and may need some adjustment (it is done using a knitr hook for now)
This was first report in https://github.com/rstudio/distill/issues/418, as
distill_article()
is using downlit by default.In short, downlit is doing the highlighting instead of Pandoc but applies the classes expected by Pandoc. However the resulting structure is different, and this conflict with the CSS inserted by Pandoc. Especially, Pandoc's expect Div > pre > code > on span by line of code > spans for highlighted element.
highlight(..., classes = classes_pandoc())
currently does not create a span per line of code like Pandoc. From details shared in https://github.com/rstudio/distill/issues/418#issuecomment-958955609for input
But pandoc will produced
However, Pandoc will insert some CSS for highlighting. e.g in the case of the issue mentioned https://github.com/jgm/skylighting/blob/87d7b35731d634b9a629b23f6e06a76cf1a0c1d7/skylighting-core/src/Skylighting/Format/HTML.hs#L185
the display
inline-block
is causing formatting issue;it should apply on
<span>
after<code>
only, which are supposed to be the spans for each line, and not the ones holding the highlighting classes.I could probably deal with that on a per-format basis, to tweak the CSS, but this will need to be done with any HTML format that uses Pandoc's CSS.
It seems last changed in
evaluate_and_highlight()
from https://github.com/r-lib/downlit/pull/96 will add a span for each line of a classr-in
. This would be compatible with Pandoc.There is also a probabily that downlit support in distill should be done differently that it is now. It was done early and may need some adjustment (it is done using a knitr hook for now)