Launched: Code block syntax highlighting and page-only version history

code blocks

Collaborating with your team on code (and more) has never been easier with 2 exciting updates to code blocks and version history.

We get it. Sometimes, you just want to TypeScript instead of writing Plain Text. For those times, Coda now supports syntax formatting for code blocks! With nearly 100 languages supported, including Python, JavaScript, and Coda’s own formula language, creating, and reading technical documentation just got easier, smoother, and better looking to boot.

These new code blocks work just like the old simple code blocks — you can drag and drop them around your doc, collapse them into headers, and copy and paste pieces as you wish. Have questions about a specific line? Comment on it or even suggest changes so your team can resolve issues right from your doc.

With new code blocks, you can also select and change the code language from the block and your formatting will adapt, or use the copy button to grab your code to-go without scrolling. You can insert new code blocks and take these actions from within a text or canvas column, in addition to your doc canvas. If you have existing code blocks in your docs that you’d like to convert to the new syntax, you can do so by clicking the upgrade button in the upper right corner above the block.

We can’t want to see how you integrate code blocks into your docs to take full advantage of the flexibility of Coda — try it out by typing /code block anywhere in your doc.

We’ve also added a page-only view for doc history, so you can always see where you’ve been and where you need to go.

28f5c7fc6d46bf40875542183ce9011fa21a8262e9186da870c81638077c79e1bc8f39326cee1e2efe6499c7d0489fc93c03c4a05d48e3d7176bdf0f3b51643a041adf47dde0a6859b3f55ad1e3af5e3b5b670cec7638853338fe63ba6df61f328636ec7

Before, it could be difficult to parse the version history for your entire doc to find the change(s) you’re looking for. Now, you can easily step through changes for a relevant page, without being distracted by the changes made on other pages.

We hope these updates allow you to create better documentation and more efficiently collaborate with your team in Coda. Try it out and let us know what you think!

34 Likes

As a software engineer by profession (.NET / C# WPF, Blazor) etc., being able to save code block related documentation in my engineering related Coda docs is absolutely heartwarming! :hearts:

I’m hoping C# is available! Can’t wait to give this a try!

1 Like

Just yesterday I was adding a code block and wishing for syntax highlighting. This is such great news, and even before I could make the feature request! I am especially glad that “Coda Formula Language” is available. Bravo and thank you!

4 Likes

Is the syntax highlighting available for inline code?

Woohoo!

I’m yet to get to my computer and test it. But CFL better have those reference chips!

1 Like

Hey Paul,
No, no reference chips. Maybe sometime in the future. It would make for a nice snippet/toolbox if you could see the CFL just like you see them in de formulas.
That said, copy-paste from a codeblock back to a formula works flawless, the only thing I don’t like is that the hidden “thisRow” or “currentvalue” are written out in a codeblock and stay written out when you copy the block back to a formula. Even though I understand why that works that way, I’d rather see the chips.
Maybe the coda developers can make a special rule for CFL (or make a special codeblock for CFL) so that acts more like the coda editor.
Greetings, Joost

If only we could collapse code blocks without the heading trick…

2 Likes

I love these!! This solves SO many problems for me!

That said…fair warning: they appear to crash my doc if they get too long :frowning: I’ll try some more tests later if I have time and see if I can pinpoint something more accurate than “too long”… But I do know it doesn’t matter if I copy/paste or use the upgrade button, it still doesn’t like the long chunk of code. :sob:

Yes, the round trip from CFL in a formula to the same CFL in text back to CFL in a formula just does not work with copy/paste because of these “hidden” elements. Is there a community “standard” about what to show in code examples? Do you manually delete these hidden parts, or do you keep them since that is what was actually copied?

Coda, it would be great if you fixed this so that copy/paste round trips actually worked properly.

1 Like

This is coming soon :slight_smile: I’ll make sure to let you know when we add the ability to collapse code blocks !

1 Like

Thanks so much @Amy_Weatherford for reporting this. Our engineering team is actively looking into fixing this :pray: I’m glad that other than this issue they are helping your use cases in Coda!

1 Like

Thanks!

FYI–after spending probably too long testing, it appears there was some weirdness going on with copy/paste–maybe something hung on in rich-text copy or something? After some experimentation, I ended up pasting into MS Notepad, copying from there, and pasting fresh into a code block, and that worked fine.

That said, extremely long code blocks will definitely slow your doc down…though I suspect that’s true of any doc with many/large items. Here’s my test doc for anyone who wants to experiment:

I pasted in some text into Coda that pasted in with color. Then I applied the code block formatting and all the original coloring disappeared. The language of the code block defaulted to plain text, but I was able to manually re-apply colors. So I do not understand why the color was removed in the first place.