Bug - API returns escaped Markdown when rich text formatting is enabled

I’m storing the following Markdown in a Long text with Rich formatting enabled:

# **Conditions générales d’utilisation du service **{serviceLabel}****

When I send an API request, here is what I get from the airtable API:

\# \*\*Conditions générales d’utilisation du service \*\*{serviceLabel}\*\*\*\*

I never asked for escaping to happen. Also, it doesn’t behave like that for my other markdown fields.

Alright, I found the root cause, it’s because when a field is marked as Rich text, it handles its own internal text formatting.

So, using markdown like **Conditions générales d’utilisation du service **{serviceLabel}**** doesn’t go well. It’s not expecting actual Markdown. It’s expecting text to be formatted using the built-in tools (bold, etc.).

So, using Markdown directly in a Rich text field will not work well, because:

  • Airtable UI doesn’t understand/convert the Markdown into HTML, it keeps the markdown as-it
  • Airtable API performs some formatting against the Markdown (basically escaping, god knows why since it can’t be harmful :man_shrugging:)

But, using built-in markdown tools will work:

  • Airtable UI will convert the markdown into HTML
  • Airtable API won’t perform formatting

The problem is, copying extensive markdown content into Airtable doesn’t do the convertion between Markdown and Airtable-Markdown. So, blindly copying valid markdown will not yield the expected end-user result.

Note that you can disable the Rich formatting in such cases, and keep the normal markdown as-it. It won’t render as HTML on Airtable UI, but the API won’t perform formatting either.

3 Likes

Indeed, but you did ask for a copy of the content in a JSON result. (i.e., the API uses JSON to convey such payloads and certain embedded character sequences are not allowed in JSON elements, else they would make the JSON document unparseable). As such, I think there may be cases where escaping will occur even when the rich text formatting is disabled.