0

Suppose I have YAML list (or other supported format) that I want to print as a comma-separated list in a markdown format.

data.yml:

---
items:
    - item1
    - item2
    - item3
---

template.markdown:

**Items**: $for(items)$$items$, $endfor$

How do I get rid of the trailing comma so I get:

**Items:** item1, item2, item3

Instead of:

**Items:** item1, item2, item3,

With:

pandoc -t markdown --template template.markdown -o output.md data.yml
0

1 Answer 1

1

Simply use $sep$ specifier instead of just hardcoded , in the template.

So:

**Items**: $for(items)$$items$$sep$, $endfor$

See for loop documentation.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .