I am following this tutorial to read data from a CSV into a table on my GitHub pages website. Some of the text contain backticks, which I would like processed as markdown so that it gets displayed as code on the website. However, by default they are displayed as literal backticks. Any suggested solutions?
You could feed the data through the Markdownify filter. Example (untested code):
{{ site.data.authors[0].mtext | markdownify }}
2 Likes
Thanks! I can confirm that your suggestion works.
1 Like
From the context, I gather you’re page is HTML, so in addition to markdownify-ing markdown fields, you’ll also need to HTML-escape plain-text fields with the escape filter. For example (untested code):
{{ site.data.books[0].title | escape }}
This will produce the correct markup for special characters like “&” and “<”. I.e. the title “James & the Giant Peach” (which is invalid HTML) will be escaped to: James & the Giant Peach
1 Like