It's unclear how you're putting the pieces together, but the macro has to 
be defined at the top of the tiddler. This seems to work:

\define pos() <div class="cell positive">+</div>

<style>
/* compensating the cell padding */
.cell { margin:-1px -7px; padding:1px 7px; }
.positive { background-color:#afa; }
.negative { background-color:#faa; }
</style>

| | manual | macro |h
| A | <div class="cell negative">-</div> | - |
| B | <div class="cell positive">+</div> | <<pos>> |




On Monday, July 15, 2019 at 11:35:21 AM UTC-7, MaxGyver wrote:
>
> Recently I have switched from TiddlyWiki Classic to TiddlyWiki 5. Now it 
> has become complicated to color individual table cells. I have found this 
> workaround (somewhere in this newsgroup):
>
> <html><style>
> /* compensating the cell padding */
> .cell { margin:-1px -7px; padding:1px 7px; }
> .positive { background-color:#afa; }
> .negative { background-color:#faa; }
> </style></html>
>
> | | manual |h
> | A | <div class="cell negative">-</div> |
> | B | <div class="cell positive">+</div> |
>
> This still requires a lot of typing. So I tried creating a macro for that:
>
> \define pos() <div class="cell positive">+</div>
>
> | | manual | macro |h
> | A | <div class="cell negative">-</div> | - |
> | B | <div class="cell positive">+</div> | <<pos>> |
>
> But this doesn't work. The lower right table cell stays empty. What am I 
> doing wrong? Is it possible to create a macro containing HTML at all?
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/108e0c0d-4739-45bd-8b82-7087e67b8b13%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to