Markdown & tables


  • GNU/Linux

    Since our nodebb supports tables, what about adding some love for them to the CSS ? 🙂


    Markdown:

    First Header | Second Header
    ------------ | -------------
    Content from cell 1 | Content from cell 2
    Content in the first column | Content in the second column
    

    The result isn't that good:

    First Header Second Header
    Content from cell 1 Content from cell 2
    Content in the first column Content in the second column

    I'm using this custom CSS in my NodeBB:

    table
    {
      font-size: 14px;
    	border-collapse:collapse;
    	margin:20px 0 0;
    	padding:0;
    }
    
    table tr
    {
    	border-top:1px solid #ccc;
    	background-color:#fff;
    	margin:0;
    	padding:0;
    }
    
    table tr:nth-child(2n)
    {
    	background-color:#f8f8f8;
    }
    table tr th[align="center"], table tr td[align="center"] {
    	text-align:center;
    }
    table tr th, table tr td
    {
    	border:1px solid #ccc;
    	text-align:left;
    	margin:0;
    	padding:6px 13px;
    }
    

    And the result is quite better:

    marktables.JPG


  • Translator

    I very much like this as a optional setting. The reason I say it should be optional is because some people might want to add images in tables and add text in a cell besides that to make it look somewhat blending.


  • Community Rep

    Adding the classes table table-bordered table-striped to the table tag would work. And would have the advantage of matching whatever theme being used.


  • Admin

    This topic totally went under the radar (next time file issues on GH 😄 )

    Updated the markdown plugin as per @yariplus' suggestion and they look good now (see @pier's OP).

    Necroing this because this is the first thread on Google when searching for NodeBB table markdown syntax.


 

| |