Data Attributes and TiddlyWiki Widgets

The data-attributes are quite common in HTML+CSS+JS. However, it is not easy to use them in TiddlyWiki for example, I want TiddlyWiki create:

<img src="Motovun Jack.svg" data-preview-image>

from

[img data-preview-image [Motovun Jack.svg]]

or

<$image source="Motovun Jack.svg" data-preview-image>

But it fails.

If you provide a value for the data attribute, the first and the last syntax should work.

Trying this in tiddlywiki.com/prerelease

<$image source="x" data-preview-image="test"/>

produces

<p><img class=" tc-image-loading" src="x"></p>

Aaah, looks like we missed the image widget when adding data attribute support to widgets that create DOM nodes: [IDEA] Extend image widget with support for data and style.* attributes · Issue #8929 · TiddlyWiki/TiddlyWiki5 · GitHub

2 Likes