ToHTML() or ToMarkup() Function for strings

At times I want to preserve the HTML format of some “text” elements.

For example, I want to preserve the headers, bullet points, bold styles etc.

It would be great if I could extract the HTML markup of text elements to achieve this.

7 Likes

I would love to have this too for the API!

3 Likes

That’s exactly the case I am researching right now.

In my case we often write very technical copy for Amazon product listings and then we have to do some basic formatting in html. I’m hoping to automate this somehow as the marketing team doesn’t like dealing with html tags. :slight_smile:

2 Likes

Yes! I wish I had this often.

One way to achieve this is to manipulate the inner object structure.

Each formatted cell has:

  • multi-line text (delimited by \n)
  • info about spans (for span-level formatting like bold and color)
  • info about lines (for paragraph-level formatting like list type)

so with enough tenacity it’s possible to compose HTML/Markdown out of a formatted cell.

Here’s one example of manipulating inner object structure:

Also cross-doc pulls in formatted text as markdown (I’m not 100% sure though, but I remember seeing some evidence of that); so by examining inner object structure perhaps it’s possible to extract markdown and convert to HTML with any markdown-to-HTML converter.

3 Likes

Has anyone made any progress in this?

I’m using coda to edit a large table, and some formulas to turn it into json that will be later used to create a product catalog in HTML. But the description field must have some simple formatting (like bolds, italics and line breaks). I could write HTML in the fields as I’m a developer myself, but I’ll have some other people adjusting the text, and wanted to offer them an easy way to format it.

I can format cells in big cell editing mode, but can’t find a convenient way to extract the formatting information.
(Actually, I explored @Paul_Danyliuk solution, and it seems rather easy to retrieve line-breaks, but I think I’m not tenacious enough to dive into the formatting code haha )

The alternative I’m looking into is to use markdown-like code (asterisks and underlines) and replace them by HTML tags afterwards.

1 Like

I’m working with coda to create emails and when I copy and paste I lost every style or format. I would like at least the convert the bold font to strong or b tags… :frowning: