Help needed to make the new Markdown code for Table work

I am trying to improve the format of my Journal posts, using the very welcome code just released for “Table”. After an hour or two of experimentation I managed to make one table work, but have not been able to repeat that in other parts of the post or other Journal pages.
I have tried adding “cells” and lines and spaces everywhere, but can’t figure out what’s needed. eg this

|May 2019|
| - | - | - | 
|Liaison | 1.5 | 
|Community liaison | 0 |    	
|Monitoring & research | 13.75 |            
|Sitework* | 22.5 |  
|YTD|
|Liaison| 82.25|
|Community liaison| 1.75|
|Monitoring & research| 239.5 |
|Sitework| 320.75|	

produces this
https://inaturalist.nz/projects/gahnia-grove-site-summary-and-discussion/journal/25612-report-for-end-of-year-one-june-2018-may-2019

i think, really, you’re trying to use a table format to represent 2 lists of the same items for 2 different time periods. you can do this, but i don’t think it’s really the most efficient way to do this.

i think this is what you’re trying to do:

May 2019
Liaison 1.5
Community liaison 0
Monitoring & research 13.75
Sitework* 22.5
YTD
Liaison 82.25
Community liaison 1.75
Monitoring & research 239.5
Sitework 320.75

which can be created using this:

|May 2019||
|-|-|
|Liaison|1.5| 
|Community liaison|0|    	
|Monitoring & research|13.75|            
|Sitework*|22.5|

|YTD||
|-|-|
|Liaison|82.25|
|Community liaison|1.75|
|Monitoring & research|239.5|
|Sitework|320.75|

However, you could do something this instead:

Cost May 2019 YTD
Liaison 1.5 82.25
Community liaison 0 1.75
Monitoring & research 13.75 239.5
Sitework* 22.5 320.75

which would be created using this:

|Cost|May 2019|YTD|
|-|-|-|
|Liaison|1.5|82.25|
|Community liaison|0|1.75|	
|Monitoring & research|13.75|239.5|    
|Sitework*|22.5|320.75|

you could further right justify some of the columns like so:

Cost May 2019 YTD
Liaison 1.5 82.25
Community liaison 0 1.75
Monitoring & research 13.75 239.5
Sitework* 22.5 320.75

by adding colons on the separator row for columns that you want to right-justify:

|Cost|May 2019|YTD|
|-|-:|-:|
|Liaison|1.5|82.25|
|Community liaison|0|1.75|	
|Monitoring & research|13.75|239.5|    
|Sitework*|22.5|320.75|

EDIT: the text alignment / justification seems to work only in this Forum’s implementation of extended markdown. the main site’s implementation of extended markdown doesn’t seem to handle it.

2 Likes

Thanks for your prompt response pisum! I was just about to add this link to my successful table:
https://inaturalist.nz/projects/gahnia-grove-site-summary-and-discussion/journal/37415-methodology-trial-report-for-year-two-draft.

You have addressed two issues here, the one of how to present the data, and the other of how to produce the table format. I won’t be changing the data presented there a year ago, into which I great deal of thought went at the time I see you have just moved the data into the format of the spreadhseet it came from, which is indeed much more efficient but I couldn’t do it in Journal posts before we had tables.

But why are my very simple tables not working at all?

I had understood, from the instructions in one of two different guides for the use of this new code, that a minimum of 3 hyphens were needed. It is vital to use the correct format from the start, as otherwise things that happen to work now will fail later, and publications will be destroyed. So I will need to know that I am learning the correct, authorised way to do this. @tiwane can you clarify this for me?

I will work with what you’ve given me …I love the possibilities with those colons! Is it officially supported?..and report back

the hyphen just defines the split between the header row of the table and the body of the table that contains the actual data. you only need one hyphen per column that you’re trying to represent. you define the columns by using the pipes. so a table with 2 columns needs 3 pipes in each row and 2 hyphens in the separator row.

1 Like

Thanks again pisum

Why do the “rules” say a minimum of three hyphens are needed? And why is my attempt not working?

And is it possible to make the line under a cell invisible, so eg two side by side photos can be captioned underneath, and the line put under that, clarifying the caoption belongs to the photo above the caption not the one below??

would you point me to the rules you’re looking at?

1 Like

I was afraid you’d ask that. It will take me time to find them. there is a post on the iNat feed that mostly talks about the “Agree” button change, but includes the new Markdown codes. And there is a thread, on the New and Updates forum I think, about the Markdown codes. Rather than struggle through browser history now, as I already have a lot of tabs open trying to tidy up a current report, I would rather wait for @tiwane’s advice as to the authorised source of the correct code, then I can bookmark that and refer to it for perpetuity:)

ok, I have found the solution to the example of failure I gave in my first post above: I had only one column in the top (Header) row, and that limited all rows below to one cell.

Update - Yayy!!! Have been able to reproduced your suggested table pisum
https://inaturalist.nz/projects/gahnia-grove-site-summary-and-discussion/journal/25612-report-for-end-of-year-one-june-2018-may-2019

Of course that was what I had wanted to do for 2 years, but didn’t know how, and because I was not succeeding with the 2 cell table I couldn’t be sure a 3 cell one was even possible. With your example I was encouraged to persevere:)

1 Like

maybe the official markdown specs indicate three --- per column, and you can do that, but just one - per column seems to work for me.

left center right
1 2 3
|left|center|right|
|-|:-:|-:|
|1|2|3|
left center right
1 2 3
|left|center|right|
|---|:---:|---:|
|1|2|3|
1 Like

Thanks pisum. I will still wait for @tiwane’s advice, as I already have many hours of work to do to correct previously-acceptable but apparently unofficial use of code in iNat that no longer works or may no longer work with future web development.

1 Like

you’d have to do this with html. it’s possible to do in iNat journal posts, but the html tables don’t seem to play nicely with markdown tables in the journal. so you’d have to choose either markdown or html in a given post, i think.

1 Like

thanks

just to clarify, I understood it to mean there had to be at least 3 hyphens per line, ie 3 columns. the illustration was
| - | - | - |

I’d recommend not writing Markdown tables manually. Instead, I use a website called “Tables Generator” that allows you to either (A) create a table through inputting data into cells in a WYSIWYG fashion or (B) copy and paste spreadsheet data straight into it. After that, click on the “Generate” and the markdown code is provided for you to copy and paste. Here’s the link: https://www.tablesgenerator.com/markdown_tables

It also works for HTML, MediaWiki, & LaTeX (aahhh! thesis writing flashbacks) formatting.

1 Like

if you have a small, simple table in a spreadsheet that you want to translate into markdown, you could also just copy it into a post here in the forum. here’s how the forum translates a table:

image

today yesterday the day before
1 2 4
5 65 3
5 6 7
|today|yesterday|the day before|
|---|---|---|
|1|2|4|
|5|65|3|
|5|6|7|
1 Like

Thanks murphyslab, I’ll look at that when I have time. But are you sure that method meets the iNat code and will always work? That is really important, I have found.

so how would that then get into my journal posts? It wouldn’t be appropriate to redirect my readers - few but formal and not iNat members - to the Forum.

Create by dropping into the forum, but then edit that and copy the code for the table to paste into your journal post.

2 Likes

yes, when you paste the code into the forum, you don’t need to actually save the forum post. just copy the markdown that the forum generates, and paste it into the main site. you can simply discard the forum post draft afterward.

1 Like

Thanks both of you