[Documentation Bug] The “Order of Tagged Tiddlers” documentation tiddler gives an incorrect description of the algorithm

Author: sobjornstadCreated Aug 27, 2026Updated Aug 27, 2026

Problem Description Per the function here: https://github.com/TiddlyWiki/TiddlyWiki5/blob/master/core/modules/wiki.js#L751C1-L751C49

Tiddlers are actually ordered like this when building a tag list:

  1. All tiddlers in the list field of the tagging tiddler are placed in an array.
  2. All remaining tagged tiddlers that aren't in list get placed alphabetically (arguably technically not “case-insensitively”; it uses localeCompare() to build that list, which deterministically breaks ties by case; but this is probably too pedantic to be worth including) at the end.
  3. TiddlyWiki goes through each tiddler in the list checking for list-before and list-after fields, and moves the tiddler based on the first condition that obtains, if any (special case: if the tiddler has already been recursed into, as described in a moment, don't check it again):
    • list-before empty -> to the start of the list
    • list-after empty -> to the end of the list
    • list-before pointing to a tiddler in the list -> before that tiddler ­– after first applying any list-before field on the before-tiddler (recursively)
    • list-after pointing to a tiddler in the list -> after that tiddler ­– after first applying any list-after field on the after-tiddler (recursively)

The documentation instead claims that it goes like this (my comments in [brackets]):

  1. Start with any that are declared in the list field of the tag tiddler, in the order given there.

  2. In each remaining tiddler T [incorrect: it checks all tiddlers T tagged by the tiddler being evaluated, whether they were in the list field or not], look for a list-before field. If this has a tiddler title as its value, place T just before that one.

    • As a special case, if the field exists but its value is empty, place T at the very start of the list.
  3. In each remaining tiddler T [incorrect: each tiddler is checked for list-before and list-after fields simultaneously; this makes it sound like it makes two complete passes, one for before and one for after], look for a list-after field. If this has a tiddler title as its value, place tiddler T just after that one.

    • As a special case, if the field exists but its value is empty, place T at the very end of the list. [incorrect: this step comes earlier, taking precedence over a list-before field with a value]
  4. If any tiddlers still remain, place them at the end of the list in ascending alphabetical order of title. The difference between capital and lowercase letters is ignored. [describes the actual effect, but is misleading and IMO makes it harder to understand the preceding parts of the algorithm: this happened between steps 1 and 2]

I should note that the current documentation also doesn't describe the recursive behavior at all, which I think could lead you to believe it would do something quite different than what it actually does.

To Reproduce You can test the behavior on https://tiddlywiki.com, and see that it matches the behavior described by the code, and not that described by the documentation (duh, I guess).

Expected behavior The documentation should accurately describe the behavior of a live wiki. A number of edge cases are currently described wrongly; most importantly (and this is not really an edge case), it currently sounds like list fields take precedence over list-before or list-after fields, when the reverse is true.

TiddlyWiki Configuration TiddlyWiki 5.4.1, live on https://tiddlywiki.com. Platform not relevant for this report.