Help needed to make the new Markdown code for Table work

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

But are you sure that method meets the iNat code and will always work?

I can’t guarantee that. However, I’d like to point something out:

The feature announcement post here on iNat included this explanatory comment with two links:

We’re supporting most of basic Markdown formatting, plus the tables extension, even though we don’t have buttons for all those things.

Clicking that “tables extension” link brings you to a page which explains the syntax (worth reading) and includes this tip:

Tip: Creating tables with hyphens and pipes can be tedious. To speed up the process, try using the Markdown Tables Generator. Build a table using the graphical interface, and then copy the generated Markdown-formatted text into your file.

… so I’ll let you do the math on that question.

1 Like

Oh, thanks for pointing that out! As much of the info in the post was over my head I wasnt able to absorb it all. That’s a great help, now I can take down the flag in my head that says "…and there was something more in that post I need to follow up at some stage …:)

I have a great deal more confidence with the help I have had in this thread.

1 Like

Here is what was given for Table creation in the iNat feed on the new use of Markdown

|this|is|
|-|-|
|a|table|

So I am confused about what was meant by “a minimum of 3 hyphens”, and I still don’t a single, ie one place to go, source for the code which will be supported by iNat ongoing. @tiwane Could an update be issued for just this issue, of code that is and will supported in all areas of the iNat website, or even just the Journals, from now on??

are you taking this from here (https://www.markdownguide.org/extended-syntax/#tables)?

To add a table, use three or more hyphens ( --- ) to create each column’s header, and use pipes ( | ) to separate each column. You can optionally add pipes on either end of the table.

if so, i would note that it’s three hyhens per column, and i would also point you further up on that page, which states:

Not all Markdown applications support extended syntax elements. You’ll need to check whether or not the lightweight markup language your application is using supports the extended syntax elements you want to use. If it doesn’t, it may still be possible to enable extensions in your Markdown processor.

more in the context of this discussion, each implementation of markdown may interpret syntax for tables a little differently, which is why the forum handles column alignment, but the the main site doesn’t. in other words, i wouldn’t take the three-hyphen-per-column guidance as gospel. if you want to use 3 hyphens per column, then that’s fine. if you want to use more per column, that should work. if you want to use just one per column, that seems to work in this particular implementation.

No, from the News and Updates thread on this forum, which I understand is the official source of information on which code to use. I understand that what you have quoted is also a recommended source, but I have to verify some source before I pursue learning to use it (which has remained unsuccessful so far for including images in Journal posts), as I have spent far too many hours and days correcting work that is no longer usable as I used code recommended on this forum that worked at the time, but now does not.
I appreciate your help pisum, but I will need staff to weigh in here before I spend the next lot of time learning and implementing this excellent new feature.

Here is the News and Updates thread that advises us of the new protocol. It is weighed down with the more controversial Agree issue, unfortunately.

https://forum.inaturalist.org/t/changes-to-the-agree-button-functionality-and-addition-of-markdown-in-comments-and-id-remarks/14566

Like the blogpost that it links to
https://www.inaturalist.org/posts/38475-less-agreeable-observations-more-agreeable-text-formatting

i don’t see “a minimum of 3 hyphens” anywhere in the blog post. could you point me to roughly where on the page you see it?

The blogpost links to https://www.markdownguide.org/extended-syntax/#tables
Which has this

Tables

To add a table, use three or more hyphens ( --- ) to create each column’s header, and use pipes ( | ) to separate each column. You can optionally add pipes on either end of the table.

```
| Syntax      | Description |
| ----------- | ----------- |
| Header      | Title       |
| Paragraph   | Text        |
```

okay. so we are talking about the same thing. see my above post where i note:

: