List items indented inconsistently in live editor when indentation is 2 spaces

Steps to reproduce

  • Create a new sandbox vault
  • Update the settings to disable indenting with tabs (so it indents with spaces)
  • Update the indentation size to be 2 spaces
  • Observe the following behavior:

2024-01-06 14.09.35

In case it isn’t clear, I hit enter then tab after each line.

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


Expected result

Consistent indentation.

Actual result

Indentation that’s is mixed between what appears to be a combo of 2 & 4 spaces, although not entirely clear what’s happening.


Additional information

	Obsidian version: v1.5.3
	Installer version: v1.4.13
	Operating system: Darwin Kernel Version 23.1.0: Mon Oct  9 21:28:45 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T6020 23.1.0
	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


I get this too. I use these indentation settings:

  • Set indent size to 2 spaces (the minimum)
  • Set indent using tabs to false/off

I also tried with smart indent lists off/on but it’s still not working right.

I notice the fold lines are showing for ~4 space divisions. There should be fold/nesting lines for every level (i.e. every 2 spaces).

This bug was introduced in a recent update (approx December 2023), previously this worked correctly.

When testing this just now I noticed that the indentation behaviour was different (more inconsistent) when typing the list vs pasting all items in one go. So there may be some smart code misfiring when typing line by line.

I suspect there’s an assumed indent level of 4 somewhere in the code that needs to be updated to use the values from preferences.



As I mentioned in another thread (now - a duplicate of this one) I believe I read in the Markdown specification, that one should use either tab or 4 spaces for indentation of lists.
I can try to find where I read it exactly.

So why 2? or 3? I think it’s not very useful to use these values at all. I’d just remove the corresponding configuration.

P.S. Of course I understand that you can have lots of notes with say 2 spaces. I myself have thousands of them :slight_smile:

Unfortunately, when you use spaces the situation is much more complicated than that. The number of spaces that need to be used depends on the length of the identifier. Two spaces are enough to indent a bullet list but not enough to indent a number list. There is also a maximum number of spaces after which it should be interpreted as codeblock.

1 tab or 4 spaces is a safe setting within the spec but the spec itself is more flexible than that.

The original spec says you have to indent 4 spaces to maintain multiple paragraphs within a single list item but does not specify indentation for sublists. CommonMark does not specify indent width but defines it relative to the marker. I use 2 spaces because 1. that’s how I write my JavaScript because 2. that’s prettier’s default indent width.

1 Like

Disabling indentation guides (which we do not currently supports when not using 4 spaces or 1 tab) , also fixes this issue.

This affects both lists and normal indented text, but in different ways.

I tested a bunch of different configurations. Here are some screenshots and findings

  • Turning off indentation guides does seem to fix many of the issues
  • The Tab Indent Size seems to have no effect on lists when Indent Using Tabs is on, even though it states Number of spaces a tab character will render as. Lists with tabs always render 4 spaces.
  • Specifying a tab size of 2 and 3 produce different types/levels of jankiness
  • Specifying a tab size of 4 displays correctly
    • Specifying a tab size of more than 4 seems to have the same effect as 4
  • the setting of “smart tabs” seems to affect things as well




Being able to decrease the visual indent (either by using actual spaces of 2 or 3, or by using a tab that takes up less space) is one of the more important features of a text editor or note app for me. I often organize notes, ideas, reference information, etc, using multiple levels of indentation (typically no more than 4), but having 4 spaces for each level means that there is very little horizontal space left for the content at deeper levels.

Sandbox, new note, no settings changed: smart indent: on, indent using tabs: on, tab indent size: 4, show indentation guides: on

smart indent: on, indent using tabs: on, tab indent size: 4, show indentation guides: off

smart indent: on, indent using tabs: on, tab indent size: 2, show indentation guides: on

Is this bug to be fixed?!

This seems to resolve the issue for me for now, altho it would be nice for indentation guides to support different spacing sizes.

Enabling indentation guides breaks everything for me now, even with Tab indent size of 4, and Indent using tabs disabled.

Without guides:

With guides:

The cursor jumps between the points marked with red by one press of the left or right arrow key (like if the first non-space character of the line got a huge padding to the left of it).

Basically, the guides are unusable at this point with any setting.

1.5.11, Windows