wikitext table formatting

197 views
Skip to first unread message

John Meyer

unread,
Mar 23, 2020, 8:36:10 PM3/23/20
to TiddlyWiki
is it possible, using wikitext, to set background-color on individual cells (which could be empty of text)?  or do I have to fall back to html for that?

It's documented in TW Classic, but that didn't work in TW5... i.e.

|something|other thing|
|background-color:blue; this thing|that thing|
||background-color:green; |

Thanks!

David Gifford

unread,
Mar 23, 2020, 8:59:35 PM3/23/20
to TiddlyWiki
No, unfortunately, that is not possible.

You CAN do it if you do an HTML table in TiddlyWiki.

A Gloom

unread,
Mar 23, 2020, 9:32:45 PM3/23/20
to TiddlyWiki
I haven't play with using @@ ,styleclass @@ for indiviidual cells that I can remember (use hrml tables more than wikitext tables) but wikitext table accept table styling classes that could be leveraged with css (nth child, etc)-- https://tiddlywiki.com/#Tables%20in%20WikiText

this from TB5 about formatting wikitext table cells -- http://tobibeer.github.io/tb5/#Formatting%20Table%20Cells

PMario

unread,
Mar 24, 2020, 10:08:14 AM3/24/20
to TiddlyWiki
Hi,
I'll post a CSS-based macro soon. It should be possible to define the row and the column.
Probably ranges .... BUT I have to have a closer look at the CSS docs ;)
-mario

PMario

unread,
Mar 24, 2020, 10:54:25 AM3/24/20
to TiddlyWiki
On Tuesday, March 24, 2020 at 1:36:10 AM UTC+1, John Meyer wrote:
is it possible, using wikitext, to set background-color on individual cells (which could be empty of text)?  or do I have to fall back to html for that?

Hi,
I did a fast experiment, following an idea. Drag and Drop import the attachment into tiddlywiki.com or your wiki and you can play with it.

The macro call looks like this: 

<<cell-bg table-class-name row:"number" column:"number">>

It looks like this:



The only thing your table needs is a leading

|myClass |k ... line ... myClass can be different for every table

I think I can tweak it a little bit and create a proper plugin! Or may be a PR for the core.

With a JS-macro we could probably make it even more powerfull.

have fun!
mario

table-css-tip-tricck.json

PMario

unread,
Mar 24, 2020, 10:58:47 AM3/24/20
to TiddlyWiki
Hi,

Be aware!

At the moment rows and columns are "hardcoded" ... So if you change your table, your macro params have to be changed too!
So the whole thing can be error prone, if you use a lot of different colours.

BUT for a little bit of colouring it should be OK.

have fun!
mario

Mohammad

unread,
Mar 24, 2020, 11:15:07 AM3/24/20
to TiddlyWiki
Added to TW-Scripts.

Hi Mario,
 This is really a tricky and clever solution using wikitext!

--Mohammad

A Gloom

unread,
Mar 25, 2020, 12:38:38 AM3/25/20
to TiddlyWiki
@Mario

Nice work on extending wikitext for tables!

John Meyer

unread,
Mar 25, 2020, 6:32:25 AM3/25/20
to tiddl...@googlegroups.com
Thanks... in my case the table is a year at a glance style calendar, with a row per week, and ebery week the top row becomes the bottom row, this changing the numbers, so I'll stick with a raw html table for highlighting holidays & special occasions

I prefer wikitext when I can because it's less scrolling in the editor, less bytes over the wire, & easier on the eyes (I'm spoiled by Razor, yes I'm a .NET dev)

--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/6XSqLdhH1dQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/e1a0a60d-005e-4469-b7e3-6e2de3b02683%40googlegroups.com.

A Gloom

unread,
Mar 25, 2020, 3:27:14 PM3/25/20
to TiddlyWiki
I prefer wikitext when I can because it's less scrolling in the editor, less bytes over the wire, & easier on the eyes (I'm spoiled by Razor, yes I'm a .NET dev)


Perfectly understtod, html tables can get long in the editor especially if you have the preview pane opened.
Reply all
Reply to author
Forward
0 new messages