Live Preview: Better support of code blocks in lists

This bug has been around for almost three years now.
Instead of focusing on the core editor, more and more features get sherlocked from other plugins.

The lack of understanding which behavior is essential to a note taking app and which bugs to fix first (this thread here has 13.5k views!) is really concerning.

5 Likes

I’m willing to try my hand at fixing this. Does Obsidian use an open source markdown parser? Or are we just totally at their mercy of whenever they decide to look at this?

5 Likes

Hi, sorry I don’t check the forums very often. Not sure if you need it but I tried to record a video with the keystrokes showing:
CleanShot 2024-11-06 at 12.34.12

Just voicing support for this. Tried Obsidian for work notes and stopped within 2 minutes because code blocks cannot format correctly in a list.

2 Likes

Hey,
It has been almost 2 years since this bug was reported. For programmers, it is a crucial feature. Can you please add it to the roadmap?

3 Likes

I’ve been hating this problem since day 1. I really wish this could be fixed too. As a programmer, it is a big problem and breaks the flow of indented lists.

Please consider.

The conclusion is clear to me: the devs don’t expect Live Preview to be relied on for notes related to software development.

Maybe there’s a plugin that tracks which pages should have Live Preview disabled from the frontmatter?

Your conclusion can be translated as:
Obsidan literally does not welcome software engineer users.

Maybe not welcoming to the type of GUI-driven software developers like Visual Basic coders but very welcoming to the type of low-level assembly coders lol

Even for machine code developers, Code Blocks are essential — whether they’re inside a list or outside of one.

That said, I’ve come to a realization: it’s not that the Obsidian developers are unwilling to address this issue—they simply lack the capability to fix it.
If you take a look at the main post, you’ll see that Code Blocks in Live Preview mode have actually been optimized to some extent. It’s just that the results fall short of expectations.
So, the only conclusion is this: the Obsidian team can’t crack this problem, and since the software is closed-source, other developers can’t step in to contribute a fix either.

So, there’s really no point in continuing to give feedback or beg for a fix for this issue — it’s not going to help. It’s just not going to happen unless a highly experienced developer shows up and manages to provide a solution for this bug without access to the source code

1 Like

Code blocks are essential, but Live Preview is not

2 Likes

Live Preview and Codeblocks are essential. The rest is not.

3 Likes

Live Preview is why I use Obsidian, and when I use code blocks they are important, so better handling of code blocks in live preview is specifically essential for me.

2 Likes

+1 important feature for me. waiting for the fix for a long time.

1 Like

The year is 2024 and Obsidian still have doesn’t indent code blocks right :woozy_face:

[citation needed]

6 Likes

I bet the same will be in 2025, 2026, 2027. Maybe in 2028

It’ll happen. They have a loooong list of priorities and have to balance development on basic needs like this and making enough money to pay for the time to develop basic needs like this.
The Obsidian team have been one of the most active projects I’ve had the pleasure of seeing and they’ve been knocking down more and more of these bugs and FRs as the team grew, so I have faith. [After all, it was @WhiteNoise who opened this ticket. They’ll fit it in when they can]

Till then, I tend to seperate my major codeblocks into their own files and include them with a ! link. It kinda works.

3 Likes

Steps to reproduce

Indent code blocks marked as Python render syntax normally, but those marked as properties do not. see blow:

It seems that only those marked as ā€˜properties’ would cause this problem.

Did you follow the troubleshooting guide? [Y/N]

Y

Expected result

Maybe they should have the same rendering effects.

Actual result

Environment

win11, obsidian v1.5.8,no css and style-related plugin.


Additional information

Could you paste that example text here in a code block (using 4 backticks so it preserves the code blocks that are in the text) so others can test it?