I'm using default setting of google-code-prettify. When a line is too long, it exceeds the boundary, like the following: Are they any possible solution to wrap the code line?
You can toggle word wrap for the VS Code session with Alt + Z (macOS: Option (or Alt) ⌥ + Z ) or select View > Word Wrap from Menu.
Word Wrap (Controls how lines should wrap) Word Wrap Column (Controls the wrapping column of the editor) Wrapping indent (Controls the indentation of wrapped lines)
You need to use pre-wrap
.
pre {
white-space: pre-wrap;
}
You can use the CSS property word-wrap: break-word;
to enable word-wrapping. Make sure that your selector has priority over Google's style, as they probably set word-wrap: nowrap;
somewhere.
For anyone using linenums you need this
:not(pre) > code {
white-space: pre-wrap;
word-wrap: break-word;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With