One more question about .tid file format

Quote from https://tiddlywiki.com/#TiddlerFiles

These files consist of a sequence of lines containing name:value pairs, a blank line and then the text of the tiddler.

The example that follows is most common. But I’m afraid the documentation is not explicit enough about edge cases.

title: Tiddler1
title: Tiddler2

title: Tiddler3


What is the value of text field in each of these cases, when these three tiddlers get imported? Tiddler2 and Tiddler3 have blank lines (no whitespaces, just \n) at the bottom.

setting up equivalents to test on my node like so:

$ 
$ cat tid1.tid
title: Tid1
$ 
$ cat tid2.tid
title: Tid2

$ 
$ cat tid3.tid
title: Tid3


$ 
$ 

They look like this within TW (I’ve shown the fields on one, the others only differ by the expected title)

When editing each, tid1 is an empty text field I can add things to.

tid2 is the same

tid3 has a blank line (the latest the insert cursor shows is the start of the second line)

Adding a single character to the last possible position within each tid, the files on disk now look like this: (note that node renamed the files to match the capitalisation of the title)

$ cat Tid1.tid
created: 20251007092135430
modified: 20251007092136723
title: Tid1
type: text/vnd.tiddlywiki

a%
$ 
$ cat Tid2.tid
created: 20251007092131782
modified: 20251007092132823
title: Tid2
type: text/vnd.tiddlywiki

b%
$ 
$ cat Tid3.tid
created: 20251007092048668
modified: 20251007092128117
title: Tid3
type: text/vnd.tiddlywiki


c%
$ 
$ 

(the % at the end of each of those is an indication that the file does NOT have an ending \n)

So in context of parsing, as I understand, this translates to:

Cut all lines that are the top of the file, and that have exactly one : pattern (as discussed in the earlier .tid related thread, this somehow hard restriction is to avoid confusing the parser) - these are the fields lines.

When parsing the rest of the file:

  1. If the string is ‘’ - there’s no even blank line separator, and the text field is ‘’ as well.
  2. If the string is ‘\n’ - just one blank line - that is the separator, and still text field is ‘’.
  3. Otherwise skip the blank line separator and everything below it is the text field.

If you import it, only tiddler 2 and 3 should have a text field.

If you open the tiddlers for editing you can not really see how the tiddlers look like, because the edit mode opens a “draft.of” tiddler. If you want to see how the tiddlers look like, you need to go to the browser console F12 and type:

$tw.wiki.getTiddler("Tiddler1")

The fields object contains the info.

  • Tiddler1 has a title field only
  • Tiddler2 has a title and text field which is empty
  • Tiddler3 has a title and text field with a \n

4 Likes