Word wrapping of code output - yihui/xaringan GitHub Wiki
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-lineclass, 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)