Skip to main content
Solved

Formatting is broken when retrieving a rich text enabled long text field through the API

  • April 28, 2020
  • 6 replies
  • 87 views

When I retrieve the content of a rich text enabled long text field through the API, only “bold” formatting works. Strikethrough and Italic are retrieved with a whitespace before the markdown symbol and therefore are not parsed correctly.

Example:

Is retrieved like this:

You can see how 50 años posteriores shows up as _ 50 años posteriores_ instead of underscore50 años posterioresunderscore without spaces between the underscores and the thing I want to make italic.

Has anyone experienced this? Is there a way to fix it?

Best answer by kuovonne

I suspect that you are seeing a space between the underscore and the other characters that are italic because when the text was originally placed in italics, the space was also included as part of the italicized text. You don’t see the space as italicized because a space in italics looks exactly like a normal space.

I have tried formatting rich text as italic, bold, strike-through, etc., (both including and excluding surrounding spaces), and the Markdown source returned by the Scripting API exactly matches what I entered. Even though you are using the Standard API instead of the Scripting API, both APIs should return the same values.

6 replies

kuovonne
Forum|alt.badge.img+29
  • Brainy
  • 6009 replies
  • Answer
  • April 29, 2020

I suspect that you are seeing a space between the underscore and the other characters that are italic because when the text was originally placed in italics, the space was also included as part of the italicized text. You don’t see the space as italicized because a space in italics looks exactly like a normal space.

I have tried formatting rich text as italic, bold, strike-through, etc., (both including and excluding surrounding spaces), and the Markdown source returned by the Scripting API exactly matches what I entered. Even though you are using the Standard API instead of the Scripting API, both APIs should return the same values.


  • Author
  • New Participant
  • 4 replies
  • April 29, 2020

I suspect that you are seeing a space between the underscore and the other characters that are italic because when the text was originally placed in italics, the space was also included as part of the italicized text. You don’t see the space as italicized because a space in italics looks exactly like a normal space.

I have tried formatting rich text as italic, bold, strike-through, etc., (both including and excluding surrounding spaces), and the Markdown source returned by the Scripting API exactly matches what I entered. Even though you are using the Standard API instead of the Scripting API, both APIs should return the same values.


This makes total sense, I checked and that’s what I think is going on there, but is this how Airtable should interpret it?

_ITALIC _ and ITALIC

Both should never be italic, so I think Airtable’s interpreter should remove leading and trailing whitespaces before placing the formatting symbols… right?

But if I go to my Rich text field and do this:

I get this:

Anyway, thanks for your help! :slightly_smiling_face:


kuovonne
Forum|alt.badge.img+29
  • Brainy
  • 6009 replies
  • April 29, 2020

This makes total sense, I checked and that’s what I think is going on there, but is this how Airtable should interpret it?

_ITALIC _ and ITALIC

Both should never be italic, so I think Airtable’s interpreter should remove leading and trailing whitespaces before placing the formatting symbols… right?

But if I go to my Rich text field and do this:

I get this:

Anyway, thanks for your help! :slightly_smiling_face:


Can you give an example of a different text editor that automatically removes leading and trailing whitespace when applying text formatting as you suggest?


  • Author
  • New Participant
  • 4 replies
  • April 29, 2020

Can you give an example of a different text editor that automatically removes leading and trailing whitespace when applying text formatting as you suggest?


Stackedit for example won’t let you format a trailing whitespace.

Also this html to markdown editor:

I guess the Standard API is not returning what it should.


kuovonne
Forum|alt.badge.img+29
  • Brainy
  • 6009 replies
  • April 30, 2020

Thank you for the examples. Those examples seem to follow John Gruber markdown, which does not allow a trailing space between a word and a closing * or _.

But if you surround an * or _ with spaces, it’ll be treated as a literal asterisk or underscore.

Airtable uses a different version of Markdown. According to this support article

Rich text in Airtable is based on on a variation of Markdown

Emphasis/bold is mine.

Hopefully Airtable will eventually support more Markdown features, including this change. However, it might be difficult for Airtable to implement this particular change without breaking existing rich text fields.


  • Author
  • New Participant
  • 4 replies
  • April 30, 2020

Thank you for the examples. Those examples seem to follow John Gruber markdown, which does not allow a trailing space between a word and a closing * or _.

But if you surround an * or _ with spaces, it’ll be treated as a literal asterisk or underscore.

Airtable uses a different version of Markdown. According to this support article

Rich text in Airtable is based on on a variation of Markdown

Emphasis/bold is mine.

Hopefully Airtable will eventually support more Markdown features, including this change. However, it might be difficult for Airtable to implement this particular change without breaking existing rich text fields.


Hopefully Airtable will eventually support more Markdown features, including this change.

I’ll be looking forward to that :slightly_smiling_face:

Thanks again for your time!