Merge column in Markdown

Viewed 1706

How can I merge column in markdown for a single value.
What I want is something like

enter image description here

What I am able to get is

Experiment TestType Value
Experiment 1 TestType1 98
Experiment 1 TestType2 73
Experiment 2 TestType1 93
Experiment 3 TestType2 79

I couldn't find anything good. Any help is appreciated.

Edit: So my ultimate goal was to display in given format. It turns out markdown is not capable of that. But ultimately I'm displaying it on browser which is able to parse HTML, so HTML solution works for me.

1 Answers

It depends on where you want to use your markdown.

If HTML elements are supported you can add a <table> to your markdown and change the colspan or rowspan as prefered. One example could look like this:

/* just for a better overview */
table {
    border-collapse: collapse;
}

table, th, td {
    border: 1px solid black;
}
<table>
    <thead>
        <tr>
            <th>Experiment</th>
            <th>TestType</th>
            <th>Value</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td rowspan=2>Experiment 1</td>
            <td>TestType1</td>
            <td>98</td>
        </tr>
        <tr>
            <td>TestType2</td>
            <td>73</td>
        </tr>
        <tr>
            <td>Experiment 2</td>
            <td>TestType1</td>
            <td>93</td>
        </tr>
        <tr>
            <td>Experiment 3</td>
            <td>TestType2</td>
            <td>79</td>
        </tr>
    </tbody>
</table>

But if you want to change the readme in Github e.g. thats not possible (see this specification).

Related