Disable code block from Horizontal scrolling?

Is there a way to make a code block that doesn’t scroll horizontally when you have long text in it?

Thanks in advance,
Matt

try this

/** Make code blocks wrap in preview mode too */
.theme-dark code[class*="language-"], .theme-dark pre[class*="language-"], .theme-light code[class*="language-"], .theme-light pre[class*="language-"] {
  word-wrap: break-word !important;
  white-space: pre-wrap !important;
}
1 Like

Am I supposed to put this CSS in the obsidian.css file under snippets?

Thanks

this would go in your theme file if you use a theme

Vault path/.obsidian/theme/theme.css

Wouldn’t it be better to put this into a separate CSS snippet instead of into a theme? You can make a single file containing this one rule and toggle it on in the appearances tab, that way you can independently turn tweaks on and off. Maybe there’s something about the Obsidian Way that I’m missing though.