Improve Code Block
B
Bruce
As a software coder, i use code block a lot. So it will be great if the code block can be improved in the following ways
1) Include numberings
2) Ability to change font. The current font is quite ugly
3) A tiny "copy code" button at specific corner
4) Ability to add a caption (top or bottom) to allow us to briefly describe the code
5) For the language, include powershell, java properties and mermaid language.
6) For mermaid language, perhaps can do similar to what notion does, show the rendered charts as well.
One thing i like about the current code block is that it allow us to change the color for specific selected part of the codes, good for us coder, who wanted to highlight specific part of the code to draw attention.
Log In
B
Brian Senecal
These suggestions are fantastic—I'm adding my vote to all of them!
I’d also love to see support for indenting code blocks so they can align with the rest of an outline or nested list. When I’m documenting a multi-step process, I often use outlines to keep things organized. But right now, code blocks always break the flow—they ignore indentation and stick out awkwardly, which really disrupts readability.
I actually came here to suggest making the copy button always visible on code blocks—only to find out it used to work that way! Please consider bringing that behavior back, or at least make it a user option, as others have already suggested.
Thanks for continuing to improve the platform!
Kosmas Ntouskos
Would it be possible to support horizontal scrolling for code blocks? The current wrapping functionality makes most snippets unreadable.
Raph Lopez
Can we have an option to collapse the code block? when storing lengthy scripts, it takes up the whole page, being able to collapse it helps when we only need to actually see the script.
Kosmas Ntouskos
Raph Lopez just fyi, we work around this by adding large code blocks inside a /toggle, that starts collapsed by default.
A
Alice Elford
A little disappointed with the latest update with the code block. The greyed out background has disappeared and you have hover over the code block to access the copy button. Can you at least have the option to revert back to the previous format. I put my code blocks throughout documents with a lot of normal text and the previous greyed out background clearly defined the code. It just looks like normal text at the moment.
Luca Vignaroli
The syntax highlighting choices are also very limited compared to those, for example, in Notion. It would be nice if we could get more of them.
Also an annoying bug should be fixed: clicking on the "copy code" button while the code block is not focused scrolls the page back to the current cursor location within the document. To test this issue simply focus the text editing cursor anywhere in the document, scroll to a code block and click copy.
Justin Hunter
Merged in a post:
Adding linenumbers to Codesnippets
Thomas Bæk Pein-Lorenzen
Would it be possible to add linenumbers to the code-boxes we use to store code in docs and tasks?
Thanks
Justin Hunter
Hey Thomas Bæk Pein-Lorenzen! Thanks for the feedback and suggestion! I'm going to merge this in with another post we're tracking. I want to aggregate the code block improvements as much as possible as we plan for the future.
Justin Hunter
Merged in a post:
Font in Code Blocks
Jorge Hernández
The font used in code blocks in the macOS App is Courier new, I think, but its kinda ugly. Just the ability to change that font and its size :)