Render HTML Document (HTML + CSS + JavaScript) in Coda (no Pack)

This trick renders any HTML document you provide (HTML+CSS+JS) using an Embed()

The rendering is done by our Github hosted server, which is based on the 'URLPages' project by `jslrieb`.

It takes the HTML+CSS+JS code encoded as Base64 as the # parameter and returns a HTML DOM that renders the code. It is sand-boxed, so its safe for both the Coda document and the Github server.

I use this to teach HTML/CSS/JS to students at the Codor Dojo club for young coders

13 Likes

This is kinda blowing my mind. I have a doc where I need to richly format a bunch of coda data; currently I link out to a serverless function that hits the Coda API and returns a pretty page. But to do this in-doc would be amazing! (not to mention not having to implement logic to guard against the API’s 5-15sec delay in getting new data and showing something stale)

3 Likes

@Nick_HE

this will render the HTML if the volume of data is not too large.

there is some limit to the size of the base 64 encoded HTML string - i have not yet encounteted it - it is several kilobytes at most, not megabytes alas.

if your usage becomes very regular, it would be best to fork your own Github webpage server just to seperate your invocation count from anyone elses.

PM me if you need help with that.

respect
max

Thanks! Yeah I might also just rethink my architecture to push from Coda to an outside processor (still feeding it just key values instead of raw HTML), rather than pulling in via API. But if I go the full HTML route I’ll fork. You’ve given me a lot to think about :slight_smile:

2 Likes

The great @Agile_Dynamics does it again. This is awesome

2 Likes

This is great, thank you so much

That’s great — just had this need and thought of having to spin up a pack+hosting to render arbitrary HTML. I thought I’d need a pack for authentication to that hosting, and to properly upload static data to a bucket. Totally forgot that I could just spin up a page that would echo back whatever content is thrown at it in a URL param, for example.

Nice find. The limit is ~76 KB per cell in Coda (or per row, I don’t remember) and there may also be some limit for the URL length itself.

hi i am trying this but the formula gives url error. what url should i put? thank you

alas, this trick no longer works.

i am working on a pack rectify this.

i will post here in a few days when it is ready.

max

2 Likes

ok @Agile_Dynamics . thanks