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
Leading whitespaces in codeblocks are removed if syntax highlighting is done. Seemingly regardless of the language used. It is common to want 6 spaces denoting input lines in APL. However, if I use APL syntax highlighting, these spaces are removed. Non-breaking spaces or additional newlines do not help.
I'm taking a look at this now. It seems like this is likely an issue with the html output of nbconvert. Here's the same notebook converted to PDF, with the spaces preserved as expected:
Confirmed this is not a problem with mistune itself (both code blocks correctly preserve whitespace whether they use apl syntax highlighting or not):
I tracked this down to an option to strip the input when the lexer is initialized in nbconvert. It's been this way for at least the last 10 years, potentially since the beginning, but I'm not sure if it's needed. Anyway, there's a PR up for this here: jupyter/nbconvert#2203.
Leading whitespaces in codeblocks are removed if syntax highlighting is done. Seemingly regardless of the language used. It is common to want 6 spaces denoting input lines in APL. However, if I use APL syntax highlighting, these spaces are removed. Non-breaking spaces or additional newlines do not help.
Here is a test notebook rendered with nbviewer: https://nbviewer.org/gist/rikedyp/59230d88565c3459d88230b8f2e3c256
And source as a GitHub gist: https://gist.github.com/rikedyp/59230d88565c3459d88230b8f2e3c256
The text was updated successfully, but these errors were encountered: