Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nested tables in markdown?

Tags:

markdown

I need to create a nested-like table in markdown like this:

enter image description here

How can I do that?

like image 691
QueSo Avatar asked Apr 24 '17 15:04

QueSo


1 Answers

@Waylan is right, you can paste HTML (of a table generated with Markdown for example) inside a cell of Markdown table.

This requires some work because you need to examine the generated HTML of a rendered (fortunately browsers like Firefox let you examine the source of a rendered HTML).

The other drawback is that the result can be unreadable, for example:

|                |ASCII                          |HTML                         |
|----------------|-------------------------------|-----------------------------|
|Single backticks|`'Isn't this fun?'`            |'Isn't this fun?'            |
|Quotes          |`"Isn't this fun?"`            |<table>  <thead>  <tr>  <th></th>  <th>ASCII</th>  <th>HTML</th>  </tr>  </thead>  <tbody>  <tr>  <td>Single backticks</td>  <td><code>'Isn't this fun?'</code></td>  <td>‘Isn’t this fun?’</td>  </tr>  <tr>  <td>Quotes</td>  <td><code>"Isn't this fun?"</code></td>  <td>“Isn’t this fun?”</td>  </tr>  <tr>  <td>Dashes</td>  <td><code>-- is en-dash, --- is em-dash</code></td>  <td>– is en-dash, — is em-dash</td>  </tr>  </tbody>  </table>      |
|Dashes          |`-- is en-dash, --- is em-dash`|-- is en-dash, --- is em-dash|

renders to:

enter image description here

in the https://stackedit.io Editor.

Finally, your example would be something like:

|   |  Returned Value |
|--| -----------------|
| Version V2 |     <table>  <thead>  <tr>  Z-value</th>  <th>06</th>  </tr>  </thead>  <tbody>  <tr>  <td>Protocol</td>  <td>04 05</td>  </tr>  <tr>  <td>Protocol Sub</td>  <td>02</td>  </tr>  <tr>  <td>Application</td>  <td>11</td>  </tr>  <tr>  <td>Application Sub</td>  <td>00</td>  </tr>  </tbody>  </table>              |

and render into:

enter image description here

It is probably not worth it. Markdown is not for that (use LaTeX instead, or LaTeX embedded Markdown if you can)

like image 197
alfC Avatar answered Sep 21 '22 06:09

alfC