New in: 5.1.16
The TiddlyWiki core adds several attributes to the rendered content. These make it possible to apply custom styles to tiddlers.
For example this tiddler is tagged: and so the attribute looks like this:
data-tags="[[How to apply custom styles]] example-test"Important: Tiddler tags are not sorted so the order in the rendered output may be different!
The following CSS is defined in Custom data-styles and creates a pink border for all tiddlers (including this one) tagged with example-test.
[data-tags*="example-test"] {
border: 2px solid pink;
}So to display tiddlers tagged: data-tags-styles in a decent way we can use the following code. (I could have used: $:/tags/Stylesheet, but that would affect all stylesheets in this wiki, which is not intended. amt ;)
Important: Don't forget to also specify .tc-tiddler-body or the whole tiddler, including the title, will be changed! see: Custom data-styles
[data-tags*="data-tags-styles"] .tc-tiddler-body {
display: block;
padding: 14px;
margin-top: 1em;
margin-bottom: 1em;
word-break: normal;
word-wrap: break-word;
white-space: pre-wrap;
background-color: #f5f5f5;
border: 1px solid #cccccc;
padding: 0 3px 2px;
border-radius: 3px;
font-family: Monaco, Consolas, "Lucida Console", "DejaVu Sans Mono", monospace;
}This mechanism may be handy for users who want to write prose text! See: Hard Linebreaks with CSS
Learn more at: Attribute selectors - CSS or CSS-Specification