Inconsistent list interaction with indent

Steps to reproduce

after a text line/paragraph, make a newline, tab indent, and make a list entry.
In code:

text  
	- broken list

In terms of input:
text\n\t- broken list

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

Yes

Expected result

The list item to get default list formatting, like if the first text line was itself a list item:
image

- test
    - ok list

The list item should also get the proper list class assignment, for the entire line:


or for the content:

Actual result

The list item does not get formatted properly:
image
On inspection, it also does not get the HyperMD-list-line class assigned:

Environment

SYSTEM INFO:
	Obsidian version: v1.6.5
	Installer version: v1.5.8
	Operating system: Windows 10 Pro 10.0.19045
	Login status: not logged in
	Insider build toggle: off
	Live preview: on
	Base theme: adapt to system
	Community theme: none
	Snippets enabled: 0
	Restricted mode: on

RECOMMENDATIONS:
	none

Additional information

I have tried to work around this issue by inspecting any trace of list-related css class in the (broken) list line, but there is none:


This means that I cannot apply list styling via css to this broken list item, because there are no distinguishing list class to select.

Interestingly, however, obsidian recognizes somehow this is in fact a list item, in that making a newline will trigger the “smart indent list” core feature
image

test
    - broken list
    - this list item was automatically generated on newline, via "smart indent list"

Hi. According to GitHub Flavoured Markdown Spec (GFM) you cannot initiate lists with four spaces. You need to use 0–3 spaces indentation to get lists recognised. Your example is treated as one paragraph (in reading view).

Edit:

One might ask what is the reason that lists don’t allow arbitrary indentation (lists allow 1–3 spaces indentation). The reason is because 4 spaces define indented code blocks. If you want to deal with custom indentation and combine lists, tables etc with that, then you might want to use Word, Google Docs or Pages for that purpose.

This is not a bug. You are making a code block.

Moved to help section.

I think that the explanation of a codeblock being used is… interesting. While I see that is what the markdown spec says, I first want to focus how Obsidian interpret this rule.

My argument here is, this is indeed a bug, in that

  1. it is not assigned the classes specifying that it is indeed code
  2. similar contexts does not turn the content into an indented code block

First of all, when an indented code block does indeed get applied, they get assigned the identifying class, and formatted differently. An example:

# Header
	this is code. formatted like code
	now this is also code

On inspection, the text gets assigned ‘cm-inline-code’, because it is infact code.


On the other hand, in the original post we can see that there are no -code class assigned. This is a contradiction.

Secondly, obsidian does not treat content indented after a text line as code. This goes beyond my specific issue described in the post (list), and to content in general: photo, embeds, text. Proof:

text 
	![[#dummy content]]
text
	![[Pasted image 20240715203843.png]]
text
	this is not code
text
	this is just indented text
	- this is also indented text?

gives:
image
Inspecting these shows that none of them are code. There are quite some nested html to unravel so I will just post the simplest example of an indented plain text line:


As one can clearly see, this line is not code.

Now I address the markdown spec: it says that indented code blocks needs to be separated by blank lines to be considered to be a indented code block. My example above is not separated by blank lines, as there is a paragraph preceding. In code:

this is not a blank line
    hence this should not be an indented code block

is different from


    this is an indented code block. Preceeded and succeeded by blank lines. In Obsidian, this is actually an indented code block, fine.

No it is not. Lines inside paragraphs are not used to initiate code blocks. This allows custom indentation inside paragraphs (except the first line). To retain indentation in the output, one must use code blocks. Hence markdown offers partial support for writing poems (using paragraphs with custom indentation or code blocks which allow custom indentation for every line although in that case without inline formatting).

https://github.github.com/gfm/#paragraphs

Lines after the first may be indented any amount, since indented code blocks cannot interrupt paragraphs.

Yes, I am sorry. I read this thread quickly. Blue_emperor answer is correct.

We try to follow commonmark. You can do your tests here

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.