Skip to main content

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:

 

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?

 


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.


Reply