## New left, right and center-aligned table bbCodes. New escape bbCode.

Dave Keenan
Posts: 1564
Joined: Tue Sep 01, 2015 2:59 pm
Location: Brisbane, Queensland, Australia
Contact:

### New left, right and center-aligned table bbCodes. New escape bbCode.

In addition to the basic table bbCodes: [table], [tr], [th], [td], Douglas and I have added the following table bbCodes to allow both headings and data to be aligned left, right or center:

left-alignedcenteredright-aligned
data[tdl] or [td][tdc][tdr]

Please ignore any previous announcement you may have seen about tn or tc. They no longer exist.

We also defined a new bbCode [_] for escaping other bbCodes, i.e. for preventing them from being interpreted, so that we can talk about them in forum posts. The bbCode [_] merely generates a left square bracket [. For example, to talk about the bold bbCode [b] you would write [_]b]. i.e. you would insert _] (i.e. underscore, right bracket) after the opening square bracket of the bbCode whose interpretation you want to prevent.

The above table makes use of all these new bbCodes. Here is the code that generated it (with the content shown in red):

[table]
[tr][th][/th][thl]left-aligned[/thl][thc]centered[/thc][thr]right-aligned[/thr][/tr]
[tr][thl]data[/thl][tdl][_]tdl] or [_]td][/tdl][tdc][_]tdc][/tdc][tdr][_]tdr][/tdr][/tr]
[/table]

cmloegcmluin
Posts: 1240
Joined: Tue Feb 11, 2020 3:10 pm
Location: San Francisco, California, USA
Real Name: Douglas Blumeyer
Contact:

### Re: New left, right and center-aligned table bbCodes. New escape bbCode.

And if you want to get really fancy, we've also added the ability to merge cells horizontally. You may need this feature, for example, if you want to have separate columns for the terms of your quotients and your monzos, while still having one centered cell which spans across them holding the main column title:

exactquotientmonzo
symbolnamen/d  2 3 5 7 cents
11M33/32[ 0 0 1 45.450¢
25/49M50/49[ 1 0 2 -2 33.400¢

The way to use this feature is simple. For any table cell bbCode ([th], [td], [thl], [thc], [thr], [tdl], [tdc], [tdr]), inside the brackets, add an equals sign followed by the number of columns to span, like this: [th=6]. It is important, though, that you then delete n-1 cells just to the right of the cell to which you are adding a span, to counteract its new span.

Here's an example:

      1           2        3        4        5        6          7
[th]monzo[/th][th][/th][th][/th][th][/th][th][/th][th][/th][th]cents[/th]


becomes:

   1 2 3 4 5 6         7
[th=6]monzo[/th] [th]cents[/th]


So, I set my column span to 6, and then deleted the 6 - 1 = 5 cells just to the right. Those five cells have essentially been merged with this "monzo" cell.

We do not yet support vertical merging. If anyone needs it, let me know.