How to turn markdown tables into bootstrap tables within October CMS

How to turn markdown tables into bootstrap tables within October CMS

With the non-published October CMS Shortcode Thunder plugin (get it here) it is can't be easier to turn markdown tables into Bootstrap tables

I have been working on a plugin named Shortcode Thunder. It is not available in the October CMS store, but it is available for free at Github. This plugin has many options, but in this article I will show just one, turning markdown tables in bootstrap tables.

Conventional markdown table

The problem with markdown in the blog editor of the Rainlab Blog plugin is that it is not a flexible as you would like it to be. The problem most of the time is adding the required classes for making it bootstrap compatible.

Sample table

| Country  | Capitol | Population |
| -- | -- | :--: |
| Netherlands  | Amsterdam | 850.000  |
| Germany  | Berlin | 2.500.000  |
| France  | Paris | 2.800.000  |
| Romania  | Bucarest | 3.100.000  |
| Luxemburg  | Luxemburg | 315.000  |

Results in:

CountryCapitolPopulation
NetherlandsAmsterdam850.000
GermanyBerlin2.500.000
FranceParis2.800.000
RomaniaBucarest3.100.000
LuxemburgLuxemburg315.000
It is not possible to place the table class anywhere with markdown. Time for a small change.

Bootstrap table with only a small adjustment

Added the shortcode thunder requirement

[table]
| Country  | Capitol | Population |
| -- | -- | :--: |
| Netherlands  | Amsterdam | 850.000  |
| Germany  | Berlin | 2.500.000  |
| France  | Paris | 2.800.000  |
| Romania  | Bucarest | 3.100.000  |
| Luxemburg  | Luxemburg | 315.000  |
[/table]

Results in:

CountryCapitolPopulation
NetherlandsAmsterdam850.000
GermanyBerlin2.500.000
FranceParis2.800.000
RomaniaBucarest3.100.000
LuxemburgLuxemburg315.000
No comments yet

your email address will not be published. required fields are marked *