Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/pdfcodeblock #11919

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

kandolfp
Copy link

@kandolfp kandolfp commented Jan 21, 2025

Description

As discussed in #11698, for PDF output, nested fenced code blocks no longer allow for page break and you can create color leakage. As this is an inherent problem with the LaTeX treatment of floating environments and the tcolorbox package (currently) used to create the background color for fenced code blocks in PDF documents a workaround is included.

The variable code-block-bg can be set to a HTML color tag or to a boolean. The boolean false has no particular effect as this will create no background color. Therefore, I selected this variable to explicitly deactivate the tcolorbox when set to false. The potential conflict with code-block-border-left is avoided by only applying the behavior if code-block-border-left is false or not set. Line numbers an annotations can be combined without any problems.

I included the example from the #11698 as a test as well but from my point of view this is not extremely helpful. I would need to test the resulting tex file for certain content and I could not find out how this is done. If you can hint me in the right direction I'm happy to extend this.

Note on implementation

This could also be implemented as a elseif but from my point of view it is cleaner this way, happy to change if you think differently.

I tried to argue why I reused a variable instead of creating a new variable but if this multi use is not wanted I can change it to a specific variable.

Miscellaneous

I also found two typos on the way. If I should create a separate PR from them please let me know.

Checklist

I have (if applicable):

this is a workaround to allow the correct display of fenced code
blocks inside floats in pdf/LaTeX by removing the default treatment
from pandoc.
@cscheid cscheid added the needs-discussion Issues that require a team-wide discussion before proceeding further label Jan 21, 2025
@cscheid
Copy link
Collaborator

cscheid commented Jan 23, 2025

Thanks for the PR! We should be able to merge something like it.

There are a few things we want to check. Specifically, Shaded is likely used by Pandoc in other scenarios and we want to make sure we're not breaking those. We'll get back to you soon.

@cscheid cscheid removed the needs-discussion Issues that require a team-wide discussion before proceeding further label Jan 23, 2025
@cscheid cscheid assigned cscheid and cderv and unassigned cscheid Jan 23, 2025
@kandolfp
Copy link
Author

Makes total sense! If I can be of help, please let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants