How does element-attributes work for tag-pill macro?

48 views
Skip to first unread message

Mark S.

unread,
May 14, 2020, 11:26:46 AM5/14/20
to TiddlyWiki
Sadly, there are no examples for tag-pill.

I would like to tell the pill to set to a particular color. I assume I can do this with the element-attributes, but I have no idea what it wants.

Thanks!

Mat

unread,
May 14, 2020, 1:27:34 PM5/14/20
to TiddlyWiki
I don't have a good answer but maybe putting this in the editor with the preview active, gives a clue:

<<tag-pill aa "" xxx= >>

<:-)

Mark S.

unread,
May 14, 2020, 2:42:23 PM5/14/20
to TiddlyWiki
Thanks for trying!

I dived into the code and see that it wants a simple string:

"""myattribute='useless-attribute'"""

Unfortunately, the attributes one would most like to override, class or style, are overridden by the macro button. Not sure what you could use it for. Maybe to add an id to the element. Hmm ... yes you could do that, but then you'd have to generate an id and a matching stylesheet definition. It would be much simpler if it let you add a style or class.

Mat

unread,
May 14, 2020, 3:44:01 PM5/14/20
to TiddlyWiki
The docs do say that the element-tag attribute doesn't have to be a span so maybe other element-tags would be more meaningful for adding attributes beyond class/style? This makes me think that the term "tag" doesn't really refer to a "tiddlywiki tag" but a "HTML tag". Also, the enforced class/list attributes made me think of so called boolean attributes (ref list). Possibly useful. 

<:-)

Mark S.

unread,
May 14, 2020, 4:15:05 PM5/14/20
to TiddlyWiki
You can change the (html) tag, but that doesn't change the order in which items are evaluated. "element-attributes" gets evaluated before "style" and "class", so gets overridden by the tag pill's own "style" and "class" which are applied later. This would be true no matter what HTML tag is selected.
Reply all
Reply to author
Forward
0 new messages