Ordered List and Continued List Number in TiddlyWiki

To continue a numbered list in TiddlyWiki’s Tiddler (using WikiText) when there is extra content between list items , you need to manually control the numbering, because the default behavior of WikiText will restart the list if anything interrupts it (like a paragraph, heading, or other content).

Here is a simple solution to have continued ordered list in TiddlyWiki.

Create a tiddler, tag it with $:/tags/Stylesheet, set its type to text/css and put below styles as its content and save.

ol {
  list-style: none;
}
ol li:before {
  counter-increment: mycounter;
  content: counter(mycounter) ". ";
}
ol:first-of-type {
  counter-reset: mycounter;
}

In any tiddler, you can insert additional content between items while ensuring that the next item continues numbering correctly from the previous one.

Example:

# Apple
# Orange

<<.lorem>>


# Melon
# Banana

Will create…

  1. Apple
  2. Orange

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

  1. Melon
  2. Banana

NOTE:
You may wrap this in a class to prevent TiddlyWiki use it globally! e.g. replace all ol above with ol.cnl and the use it like

@@.cnl
 all list and content here 
@@

Demo

Reference

3 Likes