Name code block and reference in formula

Like a formula, which can be named and then reference in other formulas, is it possible to name a code block and reference that code block in a formula?

Something like: Mermaid::DrawSequenceDiagram(thisDocument.mySequenceDigramSourceCode, …)

That would be very useful for JS Runner Pack (JS Runner Pack, extend Coda with JS Runner | Coda), the JS Flowchart Pack (JS Flowchart Pack, extend Coda with JS Flowchart | Coda), the Mermaid Pack (Mermaid Pack, extend Coda with Mermaid | Coda), an probably many more.

Regards Benno

1 Like

Hey Benno! We don’t currently have a way to name a code block in the canvas as a feature, but I can submit this as a feature request for you in the meantime. Do you mind answering the following questions so we can better understand your use case? I know you shared a bit already, so don’t feel like you need to repeat yourself :laughing: but feel free to add any additional context here!

  • What value does this new feature unlock? What does this help you accomplish?
  • On a scale of 1 to 4 (1 = nice to have, 4 = absolutely must have), how badly would you say you need this feature?
  • How would you describe what you’re trying to build with this feature? (Project tracker, blog, client-facing resource, etc.)

Thanks in advance for taking the time to answer these and providing extra context!
Nicole

Dear Nicole,

Thank you very much for your answer. I would highly appreciate having this feature. With this feature you could have a code block where you can edit code and this code being interpreted live on the page by some formula. This would allow to build something like a Jupyter Notebook in Coda, unlocking a whole new customer segment.

Another use case is that this would allow to program functionality in Javascript (with the JS Runner) and host the program code within a coda document. This allows users to program functionality without having to add a package. That is some in-between writing a formula and writing a pack. Giving the users a bit more power, without them having to learn a framework.

I hope this makes what I want clearer and not more confusing, let me know if I can provide any more input

Regards
Benno