Skip to main content
Answered

Updating article with API removes blank paragraphs


When updating an article with the API, I am finding that any blank paragraphs in the article are stripped away. This is somewhat annoying, as we often use blank paragraphs as a way to have some padding below text before the next paragraph, heading, or image.

More specifically, we may export an article with a blank paragraph that is marked up with ‘\n<p class=\"no-margin\"></p>\n’. If we feed that body directly back into the article to update it, that entire block of HTML is removed. Is there any way to preserve this?

The below image shows the blank line added between the first two lines of the article.

 

And here we see that spacing has been stripped away:

 

Best answer by Shaq Payne

Hey Ben, Shaq from the Support Engineering team here at Intercom! 👋

I understand that your team is noticing that if no text is added in paragraph tags the item is being removed. It looks like the API may not preserve empty paragraphs as they might be considered unnecessary for rendering purposes.

I can go ahead and submit this as a feature request. Would using the Line break tag be a possible workaround for your team in the meantime?

 

View original
Did this topic help you find an answer to your question?

2 replies

Shaq Payne
Intercom Team
Forum|alt.badge.img+2
  • Intercom Team
  • 27 replies
  • Answer
  • January 27, 2025

Hey Ben, Shaq from the Support Engineering team here at Intercom! 👋

I understand that your team is noticing that if no text is added in paragraph tags the item is being removed. It looks like the API may not preserve empty paragraphs as they might be considered unnecessary for rendering purposes.

I can go ahead and submit this as a feature request. Would using the Line break tag be a possible workaround for your team in the meantime?

 


  • Author
  • New Participant
  • 1 reply
  • January 27, 2025

Ah I hadn’t tested having “<br>” inside the preceding paragraph to force new lines. That seems to work. I can probably adjust my script to replace “<p>Some text</p><p></p>” with “<p>Some text<br><br></p>”. I would say it would definitely be nice to have this as a feature request though since using the article editor allows you to have empty paragraphs just fine.

Probably a more complex thing would just be tools that let you alter the padding / margin before or any element. It seems like paragraphs don’t have any additional space around them, headings have extra space below but not above, and lists seem to have extra padding above and below. We’re using these empty paragraph tags basically to just give us more uniform spacing between elements in the articles.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings