Hey! I may have missed this, but I’m trying a simple output to a Gmail node and cannot get the new lines to show up or any other type of formatting.
This is a text format. There are no error message but the output comes out as one large block of text.
Please share your workflow
Hey @Art_McDermott, hope all is well, and welcome to the community.
You question lacks details for us to understand the issue you are trying to overcome. What text do you input, how does this text appears in the email, how do you expect this text to appear etc…
Apologies for my incomplete answer. The output text is a workout plan that needs to appear in a bullet style format. Right now the output is 1 large text block with all sentences running together and formatting symbols like ‘#’ etc. It is essentially unreadable. I would love to see a clear, orderly structure with each exercise and it’s parameters (Sets, reps, etc.) appearing on separate lines. I am inputting from a free-form chat box and the output is supposed to be based on the information provided in the knowldge base. Does that make sense?
If I understand your issue correctly, you could use an HTML format instead of the text format.
My HTML doc for Gmail
<!DOCTYPE html>
<html>
<head>
<title>Dynamic Event Data Table</title>
<style>
table {
width: 90%;
border-collapse: collapse; /* Crucial for single borders */
padding: 5px; /* This will add padding to the table itself */
border: none; /* Remove outer table border */
}
th {
text-align: center; /* Center align header text */
/*padding: 10px;*/ /* Add padding to the header cell */
}
td {
vertical-align: top;
border: 1px solid black; /* Border for INNER cell boundaries */
padding: 5px; /* This will add padding to the cells */
width: 33%; /* columns */
}
</style>
</head>
<body>
<table>
<thead>
<tr>
<th colspan="3"><h3>Today's News ({{ $now.format('MMM dd, yyyy') }})</h3></th> </tr>
</thead>
<tbody>
<tr>
{{ $json.newsArticle.map((newsItem, index) => {
let cellContent = `
<center><strong>${newsItem.title}</strong></center>
<b>Date:</b> ${newsItem.published_at}
<br>
<b>Author:</b> ${newsItem.authors.name}
<br>
<b>Source:</b> <a href="${newsItem.url}">${newsItem.news_site}</a>
<br>
${newsItem.summary}
`;
let rowBreak = '';
if ((index + 1) % 3 === 0 && index < $json.newsArticle.length -1) {
rowBreak = '</tr><tr>';
}
return `<td>${cellContent}</td>${rowBreak}`;
}).join('') }}
</tr>
</tbody>
</table>
<p>---<br><small>Data provided by The SpaceDevs API</small></p>
</body>
</html>
This gives me the following formatting:
If your sentences and/or paragraphs are in separate fields, you can place them however you want in your document.
Thank you very much! I appreciate this!
@HenryPuppet is there a way to do this with the Send and Wait for Response variant of sending a message? I’m running into the same issue and it doesn’t matter if I use markdown, HTML snippet, full HTML doc, etc.
Nevermind - my markdown->HTML conversion was wrong. It’s working if you pass an HTML snippet. I wrapped an extra <div style="text-align: start !important;">...</div>
around my content to offset the template centering all the text, but otherwise, works as advertised.
Hey there, glad you got it working. 