Please fix markdown output with "rich" API

I know that normal text fields and canvas fields generate “Markdown” output if fetched from the API using valueFormat=rich. However, the generated Markdown is just awful!

A few issues:

  • Newlines in text that are not paragraph breaks are not correctly translated to markdown. Every such line needs to either end with backslash or <br>
  • Nested lists get produced exactly as flat lists with no way to get the nesting level (at least for canvas)
  • Headings are followed by a single newline. While technically correct, it looks quite crappy as paragraphs in general are separated by two newlines.
  • Unformatted fields get just prefixed with three backticks and suffixed with three backticks, which affects formatting (makes it a code block!). Instead the contents should just be escaped.

There’s probably a lot more if I continue digging.

Is there any hope of correcting these? Alternatively, simple HTML output would suffice as well (valueFormat=richHtml?) - I just need something where I can parse nested lists and other styling correctly in external tools.

1 Like

Hi @Nuutti_Kotivuori1 - Thanks for the feedback! It’s always valuable to hear how people are using the API and the issues they run in to. We did launch a major update to our editor earlier this year, and that may have had an effect on our Markdown output. I’ll raise this issue with the engineering team, but to set expectations we may not be able to make any changes in the near term.

Can you provide some more context on how you are using this data in your tools? Understanding what developers are doing with our API helps us prioritize our work.

Hi Eric,

Many of the same problems seem to occur also on the non-Canvas fields with formatting, but possibly not all. Markdown output has been problematic from the start, and it’s really one of the biggest problems for using Coda API.

As for what I’m doing is simply allowing people to write rich text descriptions for things in Coda (including formatting such as headings, bullet points, bold, links, etc.), and being able to present them on another website. I guess the simplest explanation for this is “headless CMS”.

I really can do whatever processing is needed - markdown, HTML, JSON, anything goes. If there’s internal image links, I can fetch them, reformat the images, provide them in some other manner. I don’t care if it is easy or hard - as long as there’s at least some way to get the information out of Coda.

Getting access to the Packs beta allowed me to do exactly what I want by adding a ToHtml() formula:

For example, the input “abc” gets converted to <div style="text-align: left;"><span>a</span><span style="font-weight: bold;">b</span><span>c</span></div>. I can use this formula in a computed column, and then I use the API to access the already HTML converted value, bypassing the broken Markdown generation.

1 Like