Markdown table sucks. Let's use jekyll's data files instead
Posted on June 11, 2015 • 1 minutes • 124 words
Creating a table in markdown sucks, especially if the table is quite big with some styled elements. Back before knowing data files, I came up with a plugin to help with this. First, I create folder to keep my JSON
data files. I wrapped it in a simple plugin to generate inline javascript call (AJAX) to render the table upon finish loading.
{% jsontable myjsonfilename %}
This works as expected but it’s only feasible for simple table structure. Sometimes, I want a specific table structure for a specific post. Data files are perfect for this purpose.
Data files structure is simple, easy to maintain and accessible throughout your blog via site.data.datafilename
.
There’s an example on jekyll’s documentation if you want to take a look.