Extra line in templater quote block

I have a templater command to insert a daily quote into my daily note page. It pulls from a “Daily note” page using another template that generates a random quote. It works, except the result always inserts a blank line at the beginning of the quote. It seems like an easy fix, but it’s a little beyond my skill set.

On my daily note template the command is:

<% tp.file.include(“[[Random-quote-template]]”) %>

The Random note template is:

<%* let tf = app.metadataCache.getFirstLinkpathDest(“Daily quote”,“”)
let contents = await app.vault.read(tf)
let nonEmpty = contents.split(“\n”).filter(c=>c!=“”)
let randomQuote = nonEmpty[Math.floor(Math.random()*nonEmpty.length)] -%> >
<% randomQuote %>

Any help would be appreciated.

Templater has some whitespace controls (second section of the linked post) you include in the template. You could try some of those.

2 Likes

The underscores seem to work for me. Thanks for the tip.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.