-
-
Notifications
You must be signed in to change notification settings - Fork 280
Word wrapping of code output
Kirill Müller edited this page Jun 7, 2020
·
3 revisions
Code is put into the pre
div instead of p
(normal text).
The former does not have word wrap enabled and this might cause text to overflow the slide.
I (@pat-s) am not aware of any working R-based solutions (e.g. knitr options) right now.
To prevent that, turn on word wrap in the pre
div by using the following CSS redefinition:
pre {
white-space: pre-wrap;
}
Without word wrap
With word wrap
The following CSS changes two things:
.remark-code-line {
white-space: pre-wrap;
padding-left: 1.85em;
text-indent: -1.85em;
}
- Only elements with
remark-code-line
class, and not all<pre>
elements, are wrapped - Adds indent that corresponds to approximately three characters in the default font. (Reference: https://stackoverflow.com/a/480596/946850)