Mustache web capture template line break?

I would like to have my web capture template look like this:

Selected text
[url](http://example.com)

But, if there’s no selected text, I want the URL on the first line. I tried to achieve that with this template, but no luck:

{{#selection}}{{selection}}{{{<br>}}}{{/selection}}[{{title}}]({{url}})

The line break doesn’t render (the url is on the same line as the selection). However, if there is no selection, the url is on the first line, which I want.

Try:

{{#selection}}{{selection}}
{{/selection}}[{{title}}]({{url}})

Mustache is rendering in text mode by default, so no special syntax is needed for line breaks, just put the break in the template. In this case, the line feed is inside the conditional block, so will only render if the selection is present.

2 Likes

That did it, thanks!

1 Like