Skip to content

fix(css): add background box for fenced code blocks (#439)#560

Merged
phil-davis merged 1 commit into
masterfrom
fix/code-block-styling
Jul 26, 2026
Merged

fix(css): add background box for fenced code blocks (#439)#560
phil-davis merged 1 commit into
masterfrom
fix/code-block-styling

Conversation

@DeepDiver1975

Copy link
Copy Markdown
Member

What

Adds a .mdedit .code-block rule so fenced code blocks (``` ... ```) render as a distinct box with a subtle background, padding and block display.

Why

Fenced code blocks were already tokenized by the vendored mdEdit/Prism renderer (js/vendor/mdEdit/src/md.js), but the stylesheet only gave them a text color — no background — so they were visually indistinguishable from surrounding text. This matches the reused-looking treatment inline .code already gets in mdedit.css.

Reported in #439.

Scope

This is the minimal, focused version of the CSS change originally proposed in #440. That PR bundled several unrelated changes (a search feature, a PWA manifest, .gitignore build-artifact entries, and a templates/note.php DOM change) and had gone stale with merge conflicts, so #440 is being closed in favor of this single-purpose PR.

Testing

Manual: a fenced ``` block in a note now renders with a shaded background box; inline and non-code text are unaffected.

🤖 Generated with Claude Code

Fenced code blocks (``` ... ```) were tokenized by mdEdit/Prism but
only received a text color, so they were visually indistinguishable
from surrounding text. Add a subtle background, padding and block
display to `.mdedit .code-block` so fenced blocks render as a distinct
box, matching the treatment inline `.code` already receives.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
@DeepDiver1975
DeepDiver1975 requested a review from a team as a code owner July 26, 2026 12:22
DeepDiver1975 added a commit that referenced this pull request Jul 26, 2026
Demonstrates the .mdedit .code-block styling rendering a fenced code
block as a shaded box in the Notes editor.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
@DeepDiver1975

Copy link
Copy Markdown
Member Author

Verified in a running ownCloud container (CSS docker cp'd into the live app). A fenced ``` code block now renders as a shaded box in the editor:

Fenced code block rendered as a shaded box in the Notes editor

The shading is intentionally subtle (10% gray on white). Confirmed objectively via pixel sampling rather than just eyeballing it: inside the block reads rgb(241,241,241) vs rgb(255,255,255) for the surrounding text — so the .mdedit .code-block background is applied and the box is visible.

@phil-davis
phil-davis merged commit a6405b3 into master Jul 26, 2026
12 checks passed
@phil-davis
phil-davis deleted the fix/code-block-styling branch July 26, 2026 15:08
DeepDiver1975 added a commit that referenced this pull request Jul 27, 2026
Since the version bump was authored, several user-facing PRs merged to
master that will ship inside 2.2.0. Record them in the release notes:
full translation backfill (#561), fenced-code-block background (#560),
zh-Hans/Mongolian corrections (#559), duplicate de/de_DE key removal
(#562), and the Transifex-sync retirement (#558).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
phil-davis pushed a commit that referenced this pull request Jul 27, 2026
* chore: bump version to 2.2.0

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>

* docs(changelog): cover l10n and CSS changes shipping in 2.2.0

Since the version bump was authored, several user-facing PRs merged to
master that will ship inside 2.2.0. Record them in the release notes:
full translation backfill (#561), fenced-code-block background (#560),
zh-Hans/Mongolian corrections (#559), duplicate de/de_DE key removal
(#562), and the Transifex-sync retirement (#558).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>

---------

Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants