Closed zhangxiubo closed 3 years ago
@zhangxiubo I've been meaning to add this for a while. However, I was thinking to do it the way the TiddlyWiki core adds the data-tags attribute using {{!!tags}}
See: https://github.com/Jermolene/TiddlyWiki5/blob/master/core/ui/ViewTemplate.tid#L8 Then we can do custom styling by tag as documented at: https://tiddlywiki.com/#Custom%20styles%20by%20data-tags
What do you think?
Yes that's what I wanted to do with this --- styling each row based on the node's data-node-tags
attribute. I intentionally avoided using data-tags
to allow the styling to be more specific (e.g. only highlight rows in the outliner, not the actual tiddler card). Since we already use data-node-title
, I feel it would be consistent to follow the naming convention, hence data-node-tags
{{!!tags}}
was what I tried originally to populate the attribute but it didn't work --- the attribute appeared empty when rendered as HTML. I am quite new to Tiddlywiki development so I must have missed something.
I have implemented this in https://github.com/saqimtiaz/streams/commit/b5e10358b679b15251487ce7acb65d31db4fef64
Let me know if you have any issues with it. Thank you.
For each stream-row, expose the tags associated with its corresponding tiddler in an attribute called "data-node-tags".
Multiple tags are separated with ";".
This makes it easier to style the nodes based on tags on the tiddlers.