One of my web pages needs to include rows of items (image, title, description). The description must accept markdown. I haven't found any way to do this in Jekyll without plugins or creating multiple files, one for each item.
Another requirement is that the site be built by Github Pages. ie: no Jekyll plugins, Redcarpet markdown.
Ideally, I would have liked to create a Jekyll data file (_data/products.yml) which contains a structure similar to below. Note that Description contains markdown list and formatting.
- Name: Company A Year: 2005 Description: > I was responsible for the following: - Review of contracts - Hiring - Accounting - Name: Company B Year: 2010 Description: > My role included **supervising** the marketing team and leading **publicity**.
Another option I saw was to use Front-matter with the above info. It is slightly more cumbersome since it ties the data with a particular page (eg: work-experience.md).
I've tried various variations on the above but the formatting is never transformed into HTML. How can this be handled?
YAML can include multiple, markdown-style paragraphs by using a pipe character, dropping down a line, and indenting one level.
The Front Matter extension tries to make it easy to manage your Markdown pages/content. Within a Markdown page, we allow you to fold the file's Front Matter to be less distracting when writing. Also, do we highlight the Front Matter content to create a visual difference between content and metadata.
YAML frontmatters can be defined at the beginning of a file, by starting on the first line with three dashes ( --- ) and ending the frontmatter either with three dashes or three dots (the former variant is more common). They contain valid YAML and can be used to define arbitrary variables.
A to the point front matter parser. Front matter is metadata written in yaml, located at the top of a file wrapped in --- 's. --- title: Example --- Lorem ipsum. use Spatie\YamlFrontMatter\YamlFrontMatter; $object = YamlFrontMatter::parse(file_get_contents(__DIR__.
If you do not wish to use Plugins, I believe the best bet is to have it in _data
although not sure if it would be valid YAML or even a valid YAML is a requirement for _data content.
Have you tried using markdownify
function such as
{{ site.data.products.description | markdownify }}
http://jekyllrb.com/docs/templates/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With