Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a only one row table using markdown

I use gitbook legacy editor to create a single row table

It looks fine on visual editor but looks really weird when it is on the server.

On visual editor, it is just a one-row table. On the server, it is a one-row table + an empty table body cell which looks ugly. The one-row table now becomes the table header in html.

How can I write a one-row table in markdown just like

[window| Linux| Mac]

Here is the markdown code for one-row table auto-generated by gitbook visual editor

| [Windows](https://xxxx) | [Linux x32](https://xxxx) | [Linux x64](https://xxxx) | [Mac x64](https://xxxxx) |
| :--- | :--- | :--- | :--- |
like image 883
Jack Mulin Avatar asked Jan 18 '19 21:01

Jack Mulin


People also ask

Can you create a table in Markdown?

Markdown makes it simple to format text online, such as bold text, and links. You can even make tables with Markdown.

How do I create a Markdown table without the header?

CSS solution. If you're able to change the CSS of the HTML output you can however leverage the :empty pseudo class to hide an empty header and make it look like there is no header at all.

How do you create a table in Markdown Python?

Tables. To add a table, use three or more hyphens ( --- ) to create each column's header, and use pipes ( | ) to separate each column. For compatibility, you should also add a pipe on either end of the row.


2 Answers

If anyone still need this:

First way


Single row table for github (README.md) or stackoverflow (post):

| A | B |
|-|-|

output:

A B


Second way


This one is for github markdown - it seems not working on stackoverflow:

<table>
    <tr>
        <td>A</td><td>B</td><td>C</td><td>D</td>
    </tr>
</table>

output:

enter image description here



Third way


You can use another old school way using ASCII chars:
This method is not worth it because you have to sort the characters by hand or write a script for it. But in the worst case, it might help.
Use pre tag for markdown (README.md)

<pre>
╔═══════════════╦═══════════════╗
║       A       ║       B       ║
╚═══════════════╩═══════════════╝
</pre>

<!--OR-->

<pre>
┌───────────────┬───────────────┐
│       A       │       B       │
└───────────────┴───────────────┘
</pre>
like image 61
Shamshirsaz.Navid Avatar answered Nov 16 '22 23:11

Shamshirsaz.Navid


This may not be possable. Table syntax is a non-standard Markdown feature. It is not in the official rules, but is supported by many implementations. Of course, given the lack of an official rules, each implementation works slightly differently.

That said, some of the most popular implementations are fairly consistent with only minor variations in their behavior. To name a few, PHP Markdown Extra, GitHub Flavored Markdown, the table extension for Python-Markdown1, and Pandoc's pipe tables all require a header row. In other words you cannot only have one row.

In fact, the table which gitbook visual editor auto-generated is actually a multi-row table. The full syntax for the table would be:

| Windows | Linux x32 | Linux x64 | Mac x64 |
| :------ | :-------- | :-------- | :------ |
|                                           |

Notice that the first two rows consist of a table header and the third row is an empty cell. You will find that not all implementations will automatically add the third (empty) row. Those which do not will not even recognize the one-row version as a table at all. In other words, for most implementations, that is the absolute minimum table you could create.

1 Full disclosure: I am a developer for Python-Markdown.

like image 39
Waylan Avatar answered Nov 16 '22 23:11

Waylan