For example, I’m trying to have a code block indented under a bullet point, clearly indicating that it pertains to that bullet point.
Right now, a code block always spans across the width of the whole document.
Proposed solution
When “```” is typed, start the code block from that position (Ex: 2 indents inside).
Also, perhaps, be able to have the cursor on the “outside” of the code block so that we can indent the code block as we wish (just like how the bullet points work).
There’s similar feature request. Pasting here for cross reference. Also just to add, it’s a workable solution to indent but visually not consistent especially if u have indentation guide/line
It would be nice if for the live preview, the code block’s left side starts at the indentation (as mentioned in the issue you referenced).
And as it gets nested more and more, the indentation seems to increase visually in live preview. The code (//) start becomes more distant in comparison to the bullet point text.
I think a fundamental issue with this is how a code block’s Markdown syntax is usually multiline, i.e.,
```
line 1
line 2
```
But a bullet point is treated as everything after a - or * on that one line. So how does the note parser make a multiline syntax object like code block, blockquote or callout adhere to one bullet point? does each ‘line’ of the code block have its own bullet point at the same indent level? Seems wrong. But if you don’t do this, then is the Markdown incorrect now?
I’m really not sure about this, perhaps this is one advantage of a format like org-mode over Markdown… Unless Obsidian and other Markdown tools are just smart enough to find the ending ``` or > or whatever ending multiline syntax there is and treat all of that as under the bullet point (but I don’t think they are, unlike the indented preview in this post’s Markdown).
List items can contain multiple lines — they just need to be indented correctly (which can be tricky). I’m still not sure how a code block with no preceding paragraph would work in a list item (especially in original Markdown which lacks fenced blocks), but FYI.