30

For instance, this doesn't work, tables are joined:

| Tables   |      Are      |  Cool |             | Tables   |      Are      |  Cool |
|----------|:-------------:|------:|             |----------|:-------------:|------:|
| col 1 is |  left-aligned | $1600 |             | col 1 is |  left-aligned | $1600 |
| col 2 is |    centered   |   $12 |             | col 2 is |    centered   |   $12 |
| col 3 is | right-aligned |    $1 |             
1
  • I'm fairly certain that this isn't possible, even with embedded HTML. Commented Apr 13, 2017 at 17:52

2 Answers 2

55
+50

Space between text marks the beginning and end of particular types of content. Try this:

<table>
<tr><th>Table 1 Heading 1 </th><th>Table 1 Heading 2</th></tr>
<tr><td>

|Table 1| Middle | Table 2|
|--|--|--|
|a| not b|and c |

</td><td>

|b|1|2|3| 
|--|--|--|--|
|a|s|d|f|

</td></tr> </table>

It will look like this:

two merkdown tables in one html table

Sign up to request clarification or add additional context in comments.

6 Comments

OK, I've awarded it, but it doesn't work for me :(, I'm using marked to convert to HTML. I guess it can't be done...
@igorludi That's surprising given the "why" of it working in github. If you open a question with the detail of how you are using marked and post the link here, I'd happily have a look
@igorludi I think thats a bug with marked: if i make the third line <tr><td><table></table> then it works in marked too. Whatever way you look at that, its a bug :)
is it possible to have a merged common heading ?
yes, @Cfun that would just be a case of having a colspan in the heading: <tr><th colspan=2>Table 1 Heading 1 </th></tr>
|
9

For GitHub, you can use the below format for displaying two tables side by side. This is the way I usually do it:

|Table 1|Table 2|
|--|--|
|<table> <tr><th>Table 1 Heading 1</th><th>Table 1 Heading 2</th></tr><tr><td>Row 1 Column 1</td><td>Row 1 Column 2</td></tr> </table>| <table> <tr><th>Table 2 Heading 1</th><th>Table 2 Heading 2</th></tr><tr><td>Row 1 Column 1</td><td>Row 1 Column 2</td></tr> </table>|

You can see the output here.

Note: Please do not use new line or it will not work.

2 Comments

Sorry, but this is one MD table, with HTML in two cells, I'm looking for pure markdown, or at least for the outer table to be HTML (since it will always be small - 1x2 table).
@igorludi You can reverse them and make outer table HTML and inner one MD. An example is given in the answer by spacepickle. Pure markdown in not possible, as per my knowledge.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.