Tinderbox Forum

Just a little table playground

I played with a generator for a simple table structure. You can use the generator within any template with:

^value(makeTable_db("Header A|Header B|Header C",$Text);)^

The source should be structured like this:


(\n as delimiter for the rows, a pipe | as delimiter for the cols). You could use an agent to collect the data, write it to the $text of a note and apply the template.

The output will look like this:

Have fun!

tabletool.tbx.zip (53.7 KB)



It looks like you are using a markdown syntax. CommonMark and Markdown supposedly support markdown table syntax but for some reason I can’t seem to get that to work in TBX. Maybe @mwra or @eastgate knows.

table support is very limited in markdown - see “As the official Markdown documentation states, Markdown does not provide any special syntax for tables. Instead it uses HTML syntax.”

By the way - if your are looking for the perfect colours to display your table data:

I don’t understand that statement when using pipes, a syntax in my mind, is supposed to be rendered as a table:

Is the pipes not a syntax? Interestingly, pandoc will convert these to tables. \

Also, the markdown guides says this: Extended Syntax | Markdown Guide

Is this not tables? What am I not understanding?

The linked Markdown documentation is poorly expressed. After several re=readings, I think, it means to say is that processed Extended Markdown table syntax uses normal HTML <tables> as opposed to some other method such as positioned <div>s as there a number of ways in HTML to make something that has the visual appearance of a table. The plain <table> method was designed in the days of hand-written templates when the idea of knowing about the table content was not a fanciful idea. But, not so good for large tables generated on the fly from a query. Plus the <table> attribute set sucked and early table CSS wasn’t much better.

IOW, I take the message to mean the when you use Markdown mark-up, you get plain vanilla HTML table mark-up tags.

@webline’s demo is not using Markdown to make the table. Perhaps for the stated reason that not all Markdown flavours support tables. Given this is a demo for others to use, and the user can’t be expected to know arcane Markdown flavour details, the doc uses action code to make the table mark-up. That code has a number of unstated (to the new user) assumptions:

  • the table data is all in the $Text of a note
  • each $Text paragraph is a table row (data for all columns)
  • within the paragraph, pipe (|) symbols are used to delimit columns.
  • columns populate from left, empty end of row cells need not be defined.
  • empty columns between data use two pipes (xxxx||yyyy)
  • child notes are not part of the table

Does that help?

1 Like

Researching the problem for my answer to @satikusala above, I’ve some observations on the demo doc, as a demo:

  • firstly and importantly, thanks!
  • A small read me note would help . The ‘obvious’ first try is to preview the selected (first) note, but not everyone will know to do so.
  • I’d delete the ‘HTML page’ templates child template and code reference to it. This demo only works using the current note’s $Text. The ^children^ in the template confused me.
  • the cleverness is all in the Library ‘cTableTools’ note. You’ve annotated the code nicely. But again, from experience, not everyone will find that location without help.
  • for the demo file, I’d remove the debug note (you seem to have removed the debug action code. Make with gPreferences. In other words remove any custom additions that aren’t actually used by the demo.

None of the above has to be done but all will help a wider range of users try the process without getting lost.

Again, thanks for sharing this demo. I nice idea, once I got past the strangeness of writing |-joined $Text content. :slight_smile:


Thanks, Mark. Independent of the demo, it is still not clear to my by Tinderbox is not rendering the piping syntax to an HTML table when either the CommonMark or Markdown $HTMLPeviewCommand is being used. I thought is that it should if it is supporting these engines. I’m clearly missing something.

In truth I’m no Markdown expert. Indeed my main experience of it is in Discourse forum like this. Having stated my lack of expertise, if commonMark says it supports the pipe-symbol layout you mention above, it _ought to work.

I don’t think we can blame Tinderbox here. it passes the Tinderbox HTML export output to the chosen flavour pf Markdown script. If the script fails to parse it the script has failed.

A teardown test would be to copy the script from the Tinderbox app package and run it from the command line using suitably Markdown-annotated text. If it fails then it is a Markdown issue. If it passes, then there is an internal Tinderbox issue.

i think I’d do the external test first before looking further. I’m wondering if someone familiar with Markdown use and the command line can run such a test.

The Markdown docs aren’t exactly great, so just because it says something is possible it is also possible that some pertinent configuration has been left out. IOW, table mark-up parsing it might need a particular version or later of CommonMark. AS said, one to first test in Markdown w/o Tinderbox involved.

To de-interleave this is unrelated to @webline’s demo which uses action code to make the table, albeit using a pipe symbol as a column date delimiter within lines (paragraphs) of $Text.

Perhaps we should split your issue to a searate thread as it’s actually a discrete Markdown problem?

Neither CommonMark nor classic Markdown provide a syntax for tables.

Sorry, I stand corrected. :slight_smile:

I think confusion arises on the Markdown Extended Syntax page which lists some flavours and below discusses extended points in a manner that can be read as implying the listed flavours use them.

1 Like