Markdown examples

Background

When I first started working with Markdown, I was asked to do some pretty wild things. They now seem perfectly normal and reasonable but, I wanted to document some of the techniques I learned along the way.

Table coloring

To color a table you need to use embedded CSS.

Table header Column1 Column 2 Column 3
Table row 1 Data 1 Data 2 Data 3
Table row 2 Data 1 Data 2 Data 3
The CSS for this table is:
<style>
    .table-demo {
        width: 70%;
        text-align: center;
    }
    .table-demo th {
        background: CornflowerBlue;
        word-wrap: break-word;
        text-align: center;
    }
    .table-demo tr {
        background: #99c2ff;
        word-wrap: break-word;
        text-align: center;
    }
    .table-demo tr:nth-child(1) td:nth-child(2) { background: green; }
    .table-demo tr:nth-child(2) td:nth-child(2n+2) { background: red; }
</style>

Then surround your table with:

<div class="table-demo">

</div>

Note: If you are working in VS Code, then you need to leave a blank line between the div statements and your table, or it won’t display correctly in Preview.