-
Notifications
You must be signed in to change notification settings - Fork 391
Description
Bug description
Following the "Metadata Listings" section in the documentation, it is possible to include custom metadata in YAML, either in individual files or in front matter, and have that metadata show up in a custom listing template.
For instance, we can create a listing page:
index.qmd
---
title: "Testing"
template: custom.ejs
contents:
- name: First Item
href: https://www.quarto.org
custom-field: A **custom value**
- name: Second Item
href: https://www.rstudio.org
custom-field: A *second* custom value
---
Blah
…and a custom EJS template:
custom.ejs
```{=html}
<ul>
<% for (const item of items) { %>
<li>
<a href="<%- item.href %>"><%= item.name %></a><br/>
<%= item['custom-field'] %>
</li>
<% } %>
</ul>
```
…and it will render the custom field in an HTML list:
<ul>
<li>
<a href="https://www.quarto.org/">
First Item
</a><br>
A **custom value**
</li>
<li>
<a href="https://www.rstudio.org/">
Second Item
</a><br>
A *second* custom value
</li>
</ul>
However, any Markdown formatting in the custom field is not rendered—it renders the text as A **custom value** instead of A <strong>custom value</strong>
It could be helpful to have a helper function of sorts accessible by EJS files, like
<%= parseMarkdown(item['custom-field']) %>
Rendering works as expected when raw HTML is used in the metadata. That is,
- name: First Item
href: https://www.quarto.org
custom-field: A <strong>custom value</strong>
… turns into
<li>
<a href="https://www.quarto.org/">
First Item
</a><br>
A <strong>custom value</strong>
</li>
This is with Quarto 1.3.26 in RStudio 2022.07.2+576 (and also in VS Code) on macOS Monterey 12.6
Checklist
- Please include a minimal, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
- Please format your issue so it is easier for us to read the bug report.
- Please document the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
- Please document the operating system you're running. If on Linux, please provide the specific distribution.