You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Throughout the book in a few places we need to make a code block that looks like it's running but actually it does nothing and some hidden code runs instead. There are a few examples of this in the reading chapter.
But in the PDF build, python and text blocks don't look like code /output (even though in the HTML build they do). The major issue is that the .md files get processed to .ipynb files, which distinguish between markdown and code cells -- the python and text blocks are processed as markdown, while code-cell blocks are processed as code.
The right strategy here is probably to somehow edit the pdf style of python/text blocks in myst/sphinx/jbook/???. But I really couldn't figure out how to do it (or even where to do it...).
The strategy I'm taking now in PR #341 is to actually use code blocks that run but discard their output, and fake the output as an actual code cell output using a print (eek....).
This looks the same in HTML but fixes the PDF render.
BUT it is really not great, because code that was previously in python tags that shouldn't run is actually running...so we need to handle the broken results of these now.
I'll leave this issue here just to say this is currently not fantastic and we should try to get back to the non-running python/text tag version of things at some point.
The text was updated successfully, but these errors were encountered:
trevorcampbell
changed the title
PDF non-running code blocks aren't formatted properly
PDF non-running code blocks either aren't formatted well or do have to run in the bkg
Dec 28, 2023
Throughout the book in a few places we need to make a code block that looks like it's running but actually it does nothing and some hidden code runs instead. There are a few examples of this in the reading chapter.
We used to use a pattern like:
But in the PDF build,
python
andtext
blocks don't look like code /output (even though in the HTML build they do). The major issue is that the.md
files get processed to.ipynb
files, which distinguish between markdown and code cells -- thepython
andtext
blocks are processed as markdown, whilecode-cell
blocks are processed as code.The right strategy here is probably to somehow edit the pdf style of python/text blocks in myst/sphinx/jbook/???. But I really couldn't figure out how to do it (or even where to do it...).
The strategy I'm taking now in PR #341 is to actually use code blocks that run but discard their output, and fake the output as an actual code cell output using a print (eek....).
This looks the same in HTML but fixes the PDF render.
BUT it is really not great, because code that was previously in
python
tags that shouldn't run is actually running...so we need to handle the broken results of these now.I'll leave this issue here just to say this is currently not fantastic and we should try to get back to the non-running
python
/text
tag version of things at some point.The text was updated successfully, but these errors were encountered: