Closed darthlite closed 1 year ago
Thanks for the report. Meanwhile we are looking into it, could you fix your masked link which is invalid?
Apologies, link should be fixed now.
github.theme
is a custom them we have in Quarto. It seems there needs to be some adjustment either in the .theme
file for Pandoc's skylighting library, or maybe with the way we defined the code block environment (i.e Shaded
) as it could be conflict with Beamer. @dragonstyle we are tweaking what pandoc does by default right ?
Also, if I comment out highlight-style: github, I get even stranger behavior. The whole block takes on the color of the left border:
Regarding, it could be related or just another issue regarding code-block-border-left
I think we are inserting this
\@ifundefined{shadecolor}{\definecolor{shadecolor}{HTML}{245ABE}}
\makeatother
\makeatletter
\@ifundefined{codebgcolor}{\definecolor{codebgcolor}{HTML}{f8f8f8}}
\makeatother
where code-block-border-left
is assigned to shadedcolor
, and code-block-bg
to codebgcolor
Then we are supposed to assign the codebgcolor
to the environment used for codeblock to "overwrite" the main color for Shaded environment
\ifdefined\Shaded\renewenvironment{Shaded}{\begin{tcolorbox}[boxrule=0pt, breakable, borderline west={3pt}{0pt}{shadecolor}, enhanced, colback={codebgcolor}, sharp corners, frame hidden]}{\end{tcolorbox}}\fi
but it seems colback={codebgcolor}
does not apply inside beamer. And so the default shadedcolor applies.
Looking at the diff with when we provide highlight-style: github
or not, it seems there is this environment present in .tex
\newenvironment{Shaded}{\begin{snugshade}}{\end{snugshade}}
Should be replaced by tcolorbox
but maybe that does not work...
Something specifc to handle here IMO... 🤔
Sidenote: The default behavior is already not the same for codeblock with PDF and Beamer.
Ok - I think I got to the bottom of it
It seems our redefinition of Shaded
environment is not taken into account in Beamer. We include it as before-body
.
https://github.com/quarto-dev/quarto-cli/blob/912f9534a1df39efb8557235577d10c1280c825d/src/resources/filters/layout/meta.lua#L97-L101
Including it in preamble solves this issue.
diff --git a/src/resources/filters/layout/meta.lua b/src/resources/filters/layout/meta.lua
index 611c8b041..c64b4e174 100644
--- a/src/resources/filters/layout/meta.lua
+++ b/src/resources/filters/layout/meta.lua
@@ -96,7 +96,7 @@ function layout_meta_inject_latex_packages()
-- redefined the 'Shaded' environment that pandoc uses for fenced
-- code blocks
- metaInjectLatexBefore(meta, function(inject)
+ metaInjectLatex(meta, function(inject)
inject("\\ifdefined\\Shaded\\renewenvironment{Shaded}{\\begin{tcolorbox}[" .. tColorOptions(options) .. "]}{\\end{tcolorbox}}\\fi")
end)
end
@dragonstyle Do you remember why doing the redefinition of Shaded
with tcolorbox
happens after \begin{}
, with before-body
? It is like this from the start (https://github.com/quarto-dev/quarto-cli/commit/2d9642435cb26b7a891359bde86cc985fa0048b1)
I see two solutions here:
headers-includes
beamer
output format to not change how it behave with pdf
format. What are you thoughts ? Happy to discuss live if needed.
Thanks @dragonstyle and Thanks @darthlite for the report !
Thank you all for your work and for the speedy fix!
Bug description
I think I'm facing a bug, but let me know if I'm not doing things right.
When outputting to a beamer format, I can't get code block formatting to behave as I would like. Specifically, using the options
code-block-bg
,code-block-border-left
, andhighlight-style
, I do not get any background color or left border at all. This is despite all 3 of these properties being part of the beamer options.The same combination of settings works perfectly when outputting to a pdf format, however.
Steps to reproduce
Here is a MWE with the issue: