Code font and background knobs - #128
Draft
dylandeheer wants to merge 2 commits into
Draft
Conversation
The theme can recolor every element except heading text (it inherits bodyText), and the heading config covers every metric except the face — so an embedder that wants serif display headings over a sans body has to fork. HeadingStyle.fontName picks a PostScript face for headings, honored exactly so the chosen weight survives; an unresolvable name falls back to the stock bold base font, like TaskCheckboxStyle's symbol fallback. MarkdownEditorTheme.headingText colors heading text while the `#` glyphs stay on headingMarker and inline constructs inside a heading keep their own ink. Emphasis inside a heading still composes on top of the configured face (traits added, family and per-level size kept). Both knobs default to nil, which keeps styling identical to before. Co-authored-by: Cursor <cursoragent@cursor.com>
Adds additive code typography and theming knobs: - CodeBlockStyle.fontName swaps the fenced-block face; nil (the default) keeps the syntax-highlighter service's font, and an unresolvable name degrades to it (mirrors HeadingStyle.fontName). - InlineCodeStyle.fontName overrides inline `code` spans independently; nil follows the block face, exactly as today. - MarkdownEditorTheme.codeBackground replaces the background behind fenced blocks and inline spans; nil keeps the service background. Code-block card chrome (corner radius, padding) is intentionally NOT included: the background today is a plain text attribute, and a card would need fragment-level drawing. Deferred. Co-authored-by: Cursor <cursoragent@cursor.com>
This was referenced Aug 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Code always renders in the syntax-highlighter service's font over the service's background. Embedders that bundle a specific mono face (e.g. Geist Mono) or theme the code background can't express that without replacing the whole highlighter service.
What's added
CodeBlockStyle.fontName: String?— PostScript face for fenced blocks.nil(the default) keeps the service font; an unresolvable name degrades to it (mirrorsHeadingStyle.fontName's fallback).InlineCodeStyle.fontName: String?— overrides inline`code`spans independently.nilfollows the block face, exactly as today.MarkdownEditorTheme.codeBackground: NSColor?— background behind fenced blocks and inline spans.nilkeeps the service background.Code-block card chrome (corner radius, padding) is intentionally not included: today's background is a plain text attribute; a card needs fragment-level drawing and feels like its own design conversation.
Tests
Tests/MarkdownEngineTests/CodeFontThemingTests.swift(5 tests): nil keeps the service font in blocks and inline; block face applies to both by default; inline face overrides independently; unresolvable names fall back; the background slot replaces the service background in blocks and inline while nil keeps it.swift build/swift testgreen locally (the twoScrollingHeaderControlleranimation-timing failures are pre-existing/environmental).Notes
Stacks on #121 (branched from
feature/heading-font-and-color; the diff over #121 is this feature only).Made with Cursor