Using Mustache Template to create lists

When I use the Mustache Template to loop through an object to produce a list there is an extra line added between items. Is there a way to suppress this? Example code below:

let t = `# Template Test
- {{item}}

let item1 = {
	item: '1'

let item2 = {
	item: '2'

let templ_data = {
	"list_test" : [item1,item2]

let template = MustacheTemplate.createWithTemplate(t);
let result = template.render(templ_data);

// Output is:
// # Template Test
// - 1
// - 2

Your template contains that line feed, it is not being added, try:

let t = `# Template Test

{{#list_test}}- {{item}}{{/list_test}}

Ah, I figured it out. Yours is close but not it either, that produces:
// - 1- 2

but embedding the new line right after the item does it:

let t = `# Template Test

{{#list_test}}- {{item}}\n{{/list_test}}`;

shoot, that works in the sample, but I’m actually using the contents of another Draft for my template layout and using the \n there doesn’t work. Got to get back to my real job though :frowning:

Modified my example, the template should just end with a line feed. If you are using `` (back-tick) template strings in JavaScript, you do not escape line feeds as \n like you would in double or single quoted strings.