[tw5] Wrap tiddler body in HTML

Is there any way to wrap each tiddly body in HTML? For example, wrap each tiddler body in a div with a certain class applied.

Thanks.
Matt

To be more clear, I’ve tried creating two new tiddlers (HTMLStart and HTMLEnd), one for the HTML before the body and one for the HTML after the body. I’ve tagged these with $:/tags/ViewTemplate, then I rearranged them so the do surround the tiddly body. But it doesn’t like that they are HTML. If I open and close a DIV in the HTMLStart tiddler, then it will display correctly on every tiddler. Same goes for the HTMLEnd tiddler. But if I open a tag in the HTMLStart tiddler and try to close it in the HTMLEnd, it doesn’t work correctly.

This is because tiddlywiki automatically close any html tag you open in a tiddler. If you want to wrap the text field in a tag, you will need to either edit $:/core/ui/ViewTemplate/body or hide it and show a custom ViewTemplate instead.

Can I ask why you need to do that ?

Yes, you can edit the template tiddler for the body, i.e the shadow tiddler called
$:/core/ui/ViewTemplate/body
Probably you should wrap the transclusion part in there with your div.

<:-)

1 Like

I’m trying to use the new tailwindcss dynamic JIT compiled CDN for TiddlyWiki. I wanted to use the typography plugin but when I defined it in a CSS tiddler it didn’t work. Placing it in the tiddler itself worked great. Using Mats solution made it work just fine though.