Circumflex Blog

web framework, object-relational mapper and other cool things for Scala

0 notes &

Markdown Tables

We are happy to announce that our bleeding edge Circumflex 2.0 Markdown implementation now supports tables. The syntax, however, differs from the one defined in PHP Markdown Extra: the table must start and end with at lest two minus signs (--). Of course, as with other block-level elements, it must be separated from other content with at least two line breaks.

Some brief examples:

-------------------------
|  Product   |  Price   |
|------------|----------|
|  Banana    |  $2      |
|  Apple     |  $1.5    |
|  Peach     |  $2.5    |
-------------------------

---------------
Product | Price
---------------
Banana  | $2
Apple   | $1.5
Peach   | $2.5
---------------

You can specify column alignment using colons (:) in the separator line (at left side for left alignment, at the right side for right alignment, at both sides for center alignment):

-------------------------
|  Product   |  Price   |
|:----------:|---------:|
|   Banana   |       $2 |
|    Apple   |     $1.5 |
|    Peach   |     $2.5 |
-------------------------

You can also give id attribute to your table:

---------------   {#mytable}
Product | Price
---------------
Banana  | $2
Apple   | $1.5
Peach   | $2.5
---------------

If you like your table being sized to whole page (width: 100%), but too lazy to apply css, just add a greater-than sign to the end of the first line of your table (but before id specificator, if any):

-------------->   {#mytable}
Product | Price
---------------
Banana  | $2
Apple   | $1.5
Peach   | $2.5
---------------

You are welcome to play with our Markdown implementation online.