catppuccin / obsidian

💎 Soothing pastel theme for Obsidian
MIT License
341 stars 15 forks source link

Feature Request: Scrollable CodeBloacks #5

Closed xidsyed closed 2 years ago

xidsyed commented 2 years ago

Could you please add support for codeblocks to be scrollable. I am tired of the word wrap i have to deal with. been searching for a way to do it myself, no luck ☹. Everyonwe who codes can tell you that the default codeblock width isnt enough.. And wrapping code makes it look like a horrible mess :( Great work on the theme btw. Super clean and aesthetic. Just needs a little polish.

mbeckrich commented 2 years ago

Do you have line wrap enabled under options > editor? Disabling line wrapping from settings restored horizontal scrolling on my end. Let me look at using css to disable it only for codeblocks. Does this look like what you’re after? https://forum.obsidian.md/t/disable-word-wrap-for-code-blocks/13210/16

mbeckrich commented 2 years ago

@xidsyed I've spent some time playing around with this and can't seem to get it working. I've looked at some popular themes to get ideas and have not found a solution there either. I think part of the issue is in how codemirror renders codeblocks. I can get to where individual lines will scroll horizontally, but moving the entire block with them has been out of reach. (I think I found a way to get full horizontal scrolling of codeblocks in Obsidian's reading mode, but that's it.)

I will keep my eye out for ways around this and add a toggle for it in Style Settings if I come across anything that works. In the meantime, your best bet might be to disable linewrapping and/or readable line lengths in Obsidian's settings and then use a css snippet for a width you'd prefer. Sorry I don't have better news!

xidsyed commented 2 years ago

Yeah. Super annoying to have code wrapped into a little block. Makes sense, I was able to do it without the livePreview. Let's Hope they come up with a fix for this soon.