Proposal: Improve Code Blocks Appearance

Hi,

Currently, code blocks are too tight against content in it and with little to no margin. This makes content feel cramped and harder to scan, especially in longer notes.

As a workaround, I’ve been using custom styles locally to add spacing and slight rounding. The result is clearer separation and better readability without affecting functionality.

Before:

After:

Based on this, I opened a PR that introduces proper spacing and subtle rounded corners for code blocks. The change is purely presentational and aims to improve structure and readability.

Need feedback from the community for the PR to be accepted:

I definitely agree about the "cramped" feeling, and the modified version is much better and somehow clearer. In the old version, I feel I am hesitating on whether is a block or it is only a visual illusion, I almost need to check if the background is really there. In the second version, my eye/mind does not hesitate, the block is there, and I can concentrate on its contents.

I don't have a strong opinion about the rounded corners; maybe rounded is prettier, maybe again it signifies more unambiguously that those are corners (and just the vertical bars hiding a larger background block).

I get that Joplin is functionality first model, but aesthetics still matter. Not sure why this isn’t discussed for this long.

If this get pulled, then I'm thinking to work on copy button for code blocks.

I also don't have an opinion on the rounded corners, but I think the padding looks better

Regarding code block copy button, there is a triaged issue already for that one: Add a "Copy code" button on code blocks · Issue #2383 · laurent22/joplin · GitHub

There are currently some plugins that offer this, but most of them only add a copy button in the viewer, I recently updated my autocomplete plugin to add one in the editor as well (works similar to obsidian where the language shows as a copy button): GitHub - bwat47/joplin-codeblock-autocomplete: Code block utilities for Joplin's markdown editor: auto-completes fenced code, copy button for code blocks, toolbar button to create code blocks · GitHub