Auto-increment numbered lists in edit mode

Are there a way to automatically create and display auto-increment lists in edit mode? Like this:
1.
|1.1
| |1.1.1
| 1.2
| |1.2.1
2.

Not by default. Markdown doesn’t support that kind of list.

But you can use a CSS snippet. This might not be the best example, and it only works in Reading Mode. There might be a better way with the new theme techniques. I’m just showing that it is possible:

Markdown:

1. Test
    1. Testing
        1. Testing again
            1. Seems to work
    2. Hello?
2. It works in Reading Mode

Result:

Snippet:

ol {
  list-style-type: none;
  counter-reset: item;
  margin: 0;
  padding: 0;
}

ol > li {
  display: table;
  counter-increment: item;
  margin-bottom: 0.6em;
}

ol > li:before {
  content: counters(item, ".") ". ";
  display: table-cell;
  padding-right: 0.6em;    
}

li ol > li {
  margin: 0;
}

li ol > li:before {
  content: counters(item, ".") " ";
}

SOURCE:

2 Likes