mugiwara85 / CodeblockCustomizer

Codeblock Customizer plugin for Obsidian
MIT License
147 stars 7 forks source link

feature request: Indent before the code block #52

Closed avraam-inside closed 9 months ago

avraam-inside commented 9 months ago

There is a known problem in obsidian - this is the design of code blocks inside lists in live preview: https://forum.obsidian.md/t/live-preview-better-support-of-code-blocks-in-lists/31352/57

Unfortunately, the authors have been dealing with the problem for almost 2 years and without result.

At the same time, you have a wonderful extension that greatly improves the user experience!

If you could add indents in front of your code blocks in the extension, it would be wonderful!

Thanks!

mugiwara85 commented 9 months ago

You mean when a codeblock is inside a list? You mean the red vertical line I drew in with red (between 1 and 2)? image

avraam-inside commented 9 months ago

I mean the need for indentation before the code block in some cases (for example, inside the list)

image

If there is an opportunity to implement this in your extension, it would be great!

mugiwara85 commented 9 months ago

ah sorry. You mean indentation. I was thinking about indentation lines. Sorry, my bad. But I am still confused a little. On the picture the codeblock is indented, or not? Maybe we are not talking about the same thing. Could you send two pictures. One where it is wrong, and one where I can see what you need?

avraam-inside commented 9 months ago

Of course: image

mugiwara85 commented 9 months ago

In reading mode it should work. image

In edit mode it doesn't. I didn't even notice that. I will look into this

mugiwara85 commented 9 months ago

can you name other cases when the code block needs to be intended? You said, inside a list, but what are the other cases?

avraam-inside commented 9 months ago

Here are the cases that come to mind:

image

If possible, you could set the left indent depending on the number of spaces before the first set of or set it to the option after (example):css indent:4

mugiwara85 commented 9 months ago

thank you! I might have an idea how to solve this. I try to solve it until the next release.

mugiwara85 commented 9 months ago

Just a quick question. This way would it be ok? image

mugiwara85 commented 9 months ago

It's not perfect, because the indentation lines are missing, but I didn't find another way to solve this reliably.

mugiwara85 commented 9 months ago

Available in version 1.2.4. Please test it, and if there is any problem, just report back.