APIs & Integrations

Renegade
Top Contributor

Timeline Templates Formatting

SOLVE

In the document "Timeline Templates and Rendering" https://developers.hubspot.com/docs/methods/timeline/timeline-template-rendering, it is stated:

 

"If you are creating or updating the template through the API, you can use \n to render a line break."

 

However, this doesn't appear to work.  How do I render a line break?

1 Accepted solution
Renegade
Solution
Top Contributor

Timeline Templates Formatting

SOLVE

I finally got something to work.  It seems that ONLY this works:

 

"  \n"

 

(...this is two spaces AND the' \n' character.)  Why?  I don't know.  😉

View solution in original post

5 Replies 5
kizus
Participant

Timeline Templates Formatting

SOLVE

Hello @Renegade I was facing the same issue as you, however after reading the link https://legacydocs.hubspot.com/docs/methods/timeline/timeline-template-rendering I've discovered that the timeline accepts the Markdown syntax. So in order to render line break, you can just use the "  \r" (two spaces followed by the return character). 😀

lscanlan
HubSpot Alumni
HubSpot Alumni

Timeline Templates Formatting

SOLVE

Hi @Renegade,

 

I think you're right that that documentation needs an update. If you take a look at the "Defining Templates" section of the Timelines Overview documentation: https://developers.hubspot.com/docs/methods/timeline/timeline-overview#defining-templates, there's a note on there: "We accept two templates: the header template which should be just one line describing the event..."

 

In testing, I was able to submit the header template with a line break, which ends up showing up in the event type itself. But on the actual record timeline, it's reduced to one line.

 

I'll ask that we get this article updated: https://developers.hubspot.com/docs/methods/timeline/timeline-template-rendering. And I'll see if we can add some validation into the API itself, since I think it makes sense to alert the developer about this, when we're not actually allowing multiple lines for a header template in the record timeline.

 

As for the detail template, I'm not sure what's actually intended here. Our documentation does state that the template is rendered through markup. And if you take a look at this cheat sheet for markdown: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#line-breaks, you'll see that you can use a double space to create line breaks. So for example:

 

line one  
line two  
line three  
line four

So basically after "line one" I have two line spaces like so: "line one  ". So again, I'm not totally sure what's intended here, and I'll need to see if the \n is working as intended. But hopefully this is helpful in the meantime. Let me know if it works for you?

 

 - Leland

Leland Scanlan

HubSpot Developer Support
0 Upvotes
Renegade
Top Contributor

Timeline Templates Formatting

SOLVE

I've read the articles on markup, and absolutely nothing works for line breaks or even bullet lists.  I find it extremely odd that this can be the case and no one has ever brought it up.  So I suppose I'm doing something wrong.  But this seems so straightforward that I don't know how it's possible to get it wrong.

 

And by the way, in your example above, why do you show "line one" and "line two" with two spaces after each, but already on separate lines?  Shouldn't it be:

 

"line one  line two  "

 

0 Upvotes
Renegade
Solution
Top Contributor

Timeline Templates Formatting

SOLVE

I finally got something to work.  It seems that ONLY this works:

 

"  \n"

 

(...this is two spaces AND the' \n' character.)  Why?  I don't know.  😉

Nusnus
Contributor

Timeline Templates Formatting

SOLVE

Your solution was the only solution that worked.

 

1. Thank you!

2. HubSpot should doc that.

3. If possible, just make the more intuitive normal /n work instead of cryptic space space /n which I'd never guess in the world..

0 Upvotes