I keep forgetting how to do this, and I never find a place that answers it online. Gists usually have pretty decent SEO.
Check out my style GitHub repo where you can see my snippets.
I keep forgetting how to do this, and I never find a place that answers it online. Gists usually have pretty decent SEO.
Check out my style GitHub repo where you can see my snippets.
| {% assign mydata=site.data.foo %} | |
| <table> | |
| <caption>Table caption</caption> | |
| <thead> | |
| {% for column in mydata[0] %} | |
| <th>{{ column[0] }}</th> | |
| {% endfor %} | |
| </thead> | |
| <tbody> | |
| {% for row in mydata %} | |
| <tr> | |
| {% for cell in row %} | |
| <td>{{ cell[1] }}</td> | |
| {% endfor %} | |
| </tr> | |
| {% endfor %} | |
| </tbody> | |
| </table> |
| <snippet> | |
| <content><![CDATA[ | |
| {% assign ${1:mydata}=${2:site.data.foo} %} | |
| <table> | |
| <caption>${3:Table caption}</caption> | |
| <thead> | |
| {% for column in ${1:mydata}[0] %} | |
| <th>{{ column[0] }}</th> | |
| {% endfor %} | |
| </thead> | |
| <tbody> | |
| {% for row in ${1:mydata} %} | |
| <tr> | |
| {% for cell in row %} | |
| <td>{{ cell[1] }}</td> | |
| {% endfor %} | |
| </tr> | |
| {% endfor %} | |
| </tbody> | |
| </table> | |
| ]]></content> | |
| <tabTrigger>;jekylltable</tabTrigger> | |
| <!-- Optional: Set a scope to limit where the snippet will trigger --> | |
| <!-- <scope>source.python</scope> --> | |
| <description>Create Liquid HTML based on Jekyll datafile</description> | |
| </snippet> |