This Twitter thread was a life saver! For others reference, here is a working implementation (working for me) in JavaScript.
I used the showdown library to convert Markdown to HTML, though any tool should work.
const showdown = require('showdown');
/**
* Converts the markdown to html. Webflow has known issue with parsing lists
* based on the markdown library they use. This is a workaround to convert
* the markdown to html, thing stringify it in a JSON object, the parse it,
* before sending it to the Webflow API.
*/
function convertMarkdownToRtf(markdown) {
const converter = new showdown.Converter();
/**
* Make object to stringify with rtf as the value. Replace
* new lines with empty string to circumvent parsing issues.
*/
const htmlString = JSON.stringify({
text: converter.makeHtml(markdown).replace(/\n/g, ''),
})
/* Parse the stringified object to get the string value. */
return JSON.parse(htmlString).text;
}
The returned text, when submitted to the Webflow CMS API for an Item’s RTF field, will render out lists properly.
Aaaand now 3 years later I’m having this problem, but pushing from Notion.
Worked fine using Webflow’s plain text fields for a while and now all the sudden theres some glitch where half of them hold line breaks and the other half doesn’t. (Breaking set properly in Designer) There are even a few that hold half the line breaks but not all of them And if I connect the Designer text box to a working one, it works. Connect that same Designer text box to one that doesn’t work, and it doesn’t work.
So frustrating. They even just released a new module but I just tried to send text to a rich text field and it created the CMS entry but left the RTF empty. Make/Integromat didn’t even flag an error.