Hello,
I am trying to achieve the following thing with lists:
I would like to be able to auto-increment the numbered list like this

  1. item1
    1.1 item1.1
    1.2 item1.2
  2. item2
    2.1 item2.1
    2.1.1 item2.1.1
    2.2 item2.2
    etc…

From what I read this is not yet implemented in obsidian, but maybe i don’t understand how to.

What i get is the following

  1. item1
    1. item1.1
    2. item1.2
  2. item2
    1. item2.1
      1.item2.1.1

which looks confusing
Is there a trick for that?

Thanks

I wanted to do something similar some time ago.

With CSS this isn’t achievable. I don’t know whether it would be possible with a plugin, perhaps you could ask on the discord in the plugins channel.
It is actually achievable with CSS. Thank you, @Erisred.

These are all the styles which are supported with CSS:
https://developer.mozilla.org/en-US/docs/Web/CSS/list-style-type

1 Like

Thanks for confirming what I was thinking. I will try on the discord channel to see if a genius developer can build a plugin :slight_smile:

1 Like

This is possible. Here’s one way I found with a quick internet search - slightly modified - I pulled out all styling from the linked post, along with some stuff that was affecting bullets:

/* hierarchical ordering:  */
ol {
	counter-reset: item
}
ol li {
  display: block
}
ol li:before {
  content: counters(item, ".") ". ";
  counter-increment: item
}
section > ol li::before {
	position: relative;
}

It leaves lists with pure bullets alone, but is messy with lists that have both. If you by chance need that I’m sure some deeper searching will show an answer somewhere!

Here’s what I get using the above (in case it isn’t clear, editor on top, preview on bottom)

3 Likes

Thank you for rectifying this.

Hi,
This works well.
It is only missing the option to start numbering from a specific value
But I think the css can not guess that I am continuing the list

@roms - Yes, if you take advantage of the auto-numbering Obsidian provides, things get broken once you get into the sub-items - with this simple code, anyways. Since the first level works here (1., 2., 3. etc), I’m sure this could be modified to accept the generated numbers at each level. Maybe if I get time later I could take a stab at it…