By default all the lines scroll if wider than the box, but I'd like them to wrap. How do I accomplish this?
Asked
Active
Viewed 1,885 times
6
-
Why is this a Ruby question? If it's Ruby, then you need to show code. As is, we have absolutely no idea what you're doing so any answers we give will be shooting in the dark. – the Tin Man Jan 18 '15 at 22:13
-
@theTinMan How is that at all the case? Jekyll is written in Ruby, so I thought it may be relevant, sincerest apologies. I don't see how this is that confusing, however, with the Jekyll static site generator, by default the code blocks scroll when overflow occurs. How do I cause it to wrap? – Doug Smith Jan 18 '15 at 22:15
-
It's not really important that Jekyll is written in Ruby. It could be written in C or C++, like most of an operating system, but you wouldn't tag a question with those. If Jekyll's output behaves in an acceptable manner by default, except for that one detail, and you have CSS, then perhaps the fix is adjusting the CSS for that text area? But, again, we can't see what your output is. – the Tin Man Jan 18 '15 at 22:27
-
This is not even a Jekyll or Pygments problem. It is CSS that does the wrapping. – Rudy Velthuis Jan 19 '15 at 12:47
1 Answers
13
pre {
white-space: pre-wrap;
}
And you can also make your lines are shorter than 80 characters.

the Tin Man
- 158,662
- 42
- 215
- 303

David Jacquel
- 51,670
- 6
- 121
- 147
-
-
You do the math. Some code editor have a ruler you can set to help you. – David Jacquel Jan 19 '15 at 08:24
-
1@DougSmith: David simply means that the text you write in the code part should simply not be longer than 80 characters per line. How you accomplish this is up to you. – Rudy Velthuis Jan 19 '15 at 12:49
-
2To clarify: on Jekyll 3, you need to edit **_sass/_base.scss**. Look for the block that starts with `> code {` and add the line `white-space: pre-wrap;` – Eric Sep 21 '16 at 14:36