Paste the following markdown into an Obsidian file:
- This is a new concept
- This is nested {under} the concept
- Much context is above me
- Which is why this is the {case}
- This is another item
<!--shouldn't affect rendering-->
Expected behaviour
Would render like this:
This is a new concept
This is nested {under} the concept
Much context is above me
Which is why this is the {case}
This is another item
Actual behaviour
Renders like this:
Environment
Windows 10, Obsidian 0.9.22
Additional information
I initially encountered this behaviour via an issue with my plugin. I’ve tested this behaviour in a few online markdown editors - StackEdit, Dillinger and markdowntohtml. None of them exhibit this behaviour. Even this forum’s own markdown parser doesn’t exhibit the behaviour!
I suspect the bug is the reason why this issue to do with block IDs and nested lists exists. Adding a newline seems to fix it according to the GitHub issue for my plugin, so there might be a way for me to hard-code this special case. But this feels like something that should be up to Obsidian to fix.
The “Strict line breaks” is turned off. Software rebooted after this configuration.
Note: the ![[state_transition.png]] can be any figure.
What I want to point out is with/without a line break between the lists and the figure.
We strongly recommend you to search the forum with possible keywords before submitting a new bug report. Please also try your repro steps with third-party plugins and custom CSS disabled and see if it’s still reproducible. If it’s an issue with third-party plugins or themes, try contacting the author for help. Once you’ve done the above, delete this line.
I just wanted to add that this bug effectively breaks block referencing nested lists as well when the block reference is put on the next line. The nested list as well as the embedded nested list will both be displayed as flattened.
Sorry, you probably misunderstood me. What I meant was that the flattening of the nested list is not only caused by text or comments on the line after the nested list, but also by block references on the line after. An example would be:
- 1
- 2
- 3
^foo
will be displayed as
1
2
3
in preview for the original list, as well as the embedded list ![[thispage#^foo]].
The title of this thread is “Nested list rendering broken if line after is not empty”
Isn’t this already coverded in the title?
The proper syntax for list referencing is to add a black line between the list and the id. This is the docs and it’s not just because of this bug in preview.
I’m sorry I have to object (and I actually don’t want to draw this further OT), but in the version of obsidian I am using (0.12.4) there are two different behaviors for block references:
- 1
- 2
- 2.1
^foo
gives
1
2
2.1
while without a blank line between:
- 1
- 2
- 2.1
^foo
gives (note the missing first bullet point)
2
2.1
The difference between both implementations seems to be intentional (and totally makes sense from a design point of view). If you can tell me that this is not intended behavior of obsidian, please let me know because in the moment I heavily rely on the second implementation, which is affected by the bug mentioned here…
Yes, you’re totally right. It simply wanted to highlight, that it’s not just a matter of “note to myself: don’t forget the blank lines”, but it interferes with the way block references are implemented (as described above) and there is no workaround.