Using special characters in tiddler titles

I am trying to create a tiddler that has [ and ] in its title.

Using these characters is not recommended because they could clash with various widgets:


I have personally seen poor behaviour in the past using | in titles (from an auto-importer) so I am anxious to get this right.

Using the HTML Unicode mappings for these characters, [ and ], leads them to not render in the title field:
HTML codes do not render in title field

What is a way to get these reserved characters to render when used directly in the title field?

Does this need to be part of the unique id of a tiddler that we call title? Or does it just need to appear at the top of the tiddler when you’re viewing it? Because these two do not have to be the same.

There are good reasons for the restrictions on a few characters in titles; they can really mess with filters.

But if you need only to display these properly, then you can use the ViewTemplateTitleFilter cascade to alter what’s shown. For instance, with tiddlers like this:

title: Level 1
prototcol: Alpha Protocol

More about Level 1

and

title: Level 7
prototcol: Omega Protocol

Something here

we can use that cascade to achieve something like this:

The cascade override usually takes two tiddlers:

title: $:/_/my/config/ViewTemplateTitleFilters/protocol
tags: $:/tags/ViewTemplateTitleFilter

[has[protocol]then[$:/_/my/core/ui/ViewTemplate/title/protocol]]

and

title: $:/_/my/core/ui/ViewTemplate/title/protocol

<h2 class="tc-title" title={{$:/language/SystemTiddler/Tooltip}}>
{{!!title}} <span class="tc-system-title-prefix"> [<$view field="protocol"/>]</span>
</h2>

You don’t need to get all fancy with that <span> and the gray color for the protocol. That’s just how I tend to use these.

Of course if that has to be part of the actual title, this doesn’t help at all. But in that case, I’d suggest you look hard at your requirements.

You can test this by downloading the following and dragging the resulting file onto any wiki:
ProtocolTitles.json (1014 Bytes)

1 Like

Thank you for the extended thoughts, and not a bad idea.

Unfortunately in this case, it would be semantically incorrect to put it in another field, because it is the name of a specific board game.

Well, it’s just a warning; you can still use those characters in a title.

If you need to search for it specifically, just be cautious. This is a syntax error:

{{{ [[Level 7 [Omega Protocol]]get[number-of-players]] }}}

But this should work:

<$let l7op="Level 7 [Omega Protocol]">
  {{{ [<l7op>get[number-of-players]] }}}
</$let>
1 Like

I would do as the message says and not use characters in the title that are not recomended. It can screw up all kinds of TiddlyWiki script if you do so.

  • The title is also the unique key to the information in a tiddlywiki database and to use invalid characters in the primary key of any database is unadvisable.

If the tiddler titile is already unique using Level N then the other value could be stored in another field eg; Level-name and a special addition to the title to;

  • If Level-name not empty wrap it in [ ] and display after the title. In this case [Level-name ] is just a display and will not be wikified and they are not used in the title field.

However there are a lot of look alike open and closed square brackets available in Unicode that are different but look the same or similar. I recomend similar so they can be told apart.

  • Use characters above 256 decimal to be different

That was my recommendation above, which was already rejected because the brackets are part of an externally-defined name.

Ah, but that is a very good idea! It will be harder to type, but that’s the only drawback I see.

Thats fine but I would not let the external source determin the internal primary key. There may need to be an import or export method if it needs to be between systems.

Since the closing ] bracket will definitely cause problems with filters, IMO it would be the best thing to use Level 7 - Omega Protocol. Level 7 seems to be (R) registered. But “Omega Protocol” is also used prominently without any braces with their packaging (See your link).

So I do not see any problem with the title: Level 7 - Omega Protocol as a tiddler title.
If you need to see Level 7 [Omega Protocol] you can use it as a caption field. So it will be shown with the braces in the TOC or other TW UI elements, that respect the caption field.

See this discussion [Help] regarding Caption and Title for more info.

1 Like

Thanks, I went with your Unicode solution in the end, consulting a page on Xah Lee’s website that showcases various styles of brackets in Unicode.

❲ ❳ look the part, and they work for me!