TW5: Can I put code blocks inside tables?

171 views
Skip to first unread message

Jeff Vance

unread,
Aug 31, 2016, 4:09:45 PM8/31/16
to tiddl...@googlegroups.com
 I like to keep lots of notes of syntax on various programming languages or command line tricks.  In other note tools, I often would create a table that lists the commands in one column and a description in another.  I can't find any way to do this in TW5 with so many `|<> characters.  I can't escape those characters inside inline code block (with ` code `), so I figured I'd use full code blocks...but I would really like each block to be within 1 column of a table.  I can't seem to make it work.  Is it possible?


Tobias Beer

unread,
Aug 31, 2016, 4:49:33 PM8/31/16
to TiddlyWiki
There's always good old html:

<table>
<tr>
<th>example</th>
<td>

```
runCode(foo);
alert("bar");
```
</td>
</tr>
</table>

Best wishes,

Tobias.

Zaphod Beeblebrox

unread,
Sep 4, 2016, 1:54:35 AM9/4/16
to TiddlyWiki
And, if you can tolerate the 'red text' listing, you can also transclude a tiddler or field containing your code back into your table cell, although I can't get it to work in block mode ( ``` ), just single mode ( ` ).

--Zaphod

Ton Gerner

unread,
Sep 4, 2016, 5:55:27 AM9/4/16
to TiddlyWiki
Hi Jeff, Zaphod,

You can transclude in block mode:

|<$transclude tiddler="Code tiddler" mode="block"/>|

Cheers,

Ton

Zaphod Beeblebrox

unread,
Sep 4, 2016, 6:07:42 PM9/4/16
to TiddlyWiki
Ah, yes!

Thank You for that, Ton :)

I'd forgotten about using the full <$transclude> syntax, I was using the shorthand {{$tiddler to transclude}}...

--Zaphod
Reply all
Reply to author
Forward
0 new messages