New line being added to article after paragraph when updating via API | Community
Skip to main content

When I pull down an example line in the body via API I get something like this:

\n<p class=\"no-margin\"></p>\n<p class=\"no-margin\"><b>Can I add in other activities?</b></p>\n<p class=\"no-margin\">Not at this time. If this is a feature you would like, please send us a message.</p>

When I push that back up, it adds a new line to below the bolded text. This is also happening above lists as well, but only when it’s below a <p> class.

The output looks like this:

<b>Can I add in other activities?<b/>

Not at this time. If this is a feature you would like, please send us a message.

Where the intended output should be

<b>Can I add in other activities?</b>
Not at this time. If this is a feature you would like, please send us a message.

Is this a bug? Is there a way around this?

Hey ​@Cody Iddings! Emily here from Support Engineering at Intercom 👋🏼

I just tested this myself and upon testing I could not replicate the same issue you are experiencing. What version of the API are you testing this with? Could you try using the latest version?

I used the example body you gave in your message:


Then the output of the article was as follows:


There is no gaps in between the sentences - expected behaviour. 

Maybe I am understanding you incorrectly? If so, could you give more clear instructions so I can replicate your issue on my side? Thanks!


Hi Emily, I wasn’t designating a version, and now it’s working as expected when I use 2.11 of the API. Thank you!


Glad to hear ​@Cody Iddings! 🙌🏼


Actually ​@Emilygav  now the spaces are getting stripped above the Heading Tags. Any recommendations to ensure empty spaces don’t get stripped by the API?


Hey ​@Cody Iddings 👋 

Are you only seeing this behavior above headline tags?  Can you send me a code example? 
 

 


Hi ​@Emilygav  and ​@Shaq Payne 

I'm still experiencing the spacing issue with headings via API v2.13. Here's a specific example:
What I receive from the API:
<h2 id="h_3df6601ff3">What is xAPI?</h2>

<p class="no-margin">xAPI (also called the Experience API or Tin Can API) is a modern learning technology standard...</p>

 

After editing and sending back, it becomes:
<h2 id="h_3df6601ff3">What is xAPI?</h2>

<p class="no-margin"></p>

<p class="no-margin">xAPI (also called the Experience API or Tin Can API) is a modern learning technology standard...</p>

The API is automatically inserting <p class="no-margin"></p> after headings, creating unwanted spacing. This happens even when sending the exact same content back unchanged.

Is there a way to prevent this automatic insertion via the API?

Hi ​@Emilygav,

I am experiencing the same issue as ​@Cody Iddings describes above.

When creating or updating articles via API v2.14 the `<p class="no-margin"></p>` is automatically inserted  after headings. The unwanted spacing makes articles look ugly in the customer-facing knowledge base. It doesn’t happen when adding headings in the Intercom editor.

Is there a way to prevent this unwanted behaviour ?


Reply