Skip to content

feat(highlight): add MdRenderInlineCode bg to distinguish code from headings#14

Merged
delphinus merged 1 commit into
mainfrom
feat/inline-code-bg
May 15, 2026
Merged

feat(highlight): add MdRenderInlineCode bg to distinguish code from headings#14
delphinus merged 1 commit into
mainfrom
feat/inline-code-bg

Conversation

@delphinus
Copy link
Copy Markdown
Owner

Summary

  • New MdRenderInlineCode highlight group: fg follows String (preserves the existing color cue) and bg is a subtle neutral tint (Comment fg blended with Normal/NormalFloat bg at α=0.18, same pattern as MdRenderImagePlaceholder).
  • Both backtick spans and HTML <code> tags now use it, fixing the case where inline code was visually indistinguishable from H3+ headings in colorschemes that paint both green.

Reported visually via :vert MdRender split where backtick-wrapped strings (e.g. `"fade"`) shared the same color as ### Animation Types.

Test plan

  • make test (515 passed, 0 failed; 1 assertion updated in markdown_checkbox_test.lua)
  • Smoke check with a catppuccin-like setup: MdRenderInlineCode resolves to fg=#a6e3a1 bg=#2c2d3e (Normal #1e1e2e blended with Comment #6c7086 at 0.18) — clearly distinct from the heading fg
  • Manual: open a README with many backtick spans and confirm visible bg

🤖 Generated with Claude Code

…m headings

Backtick-wrapped inline code was hardcoded to the `String` highlight
group. In many colorschemes `String` and the lower-level heading groups
(H3+) end up with the same green-ish foreground, making `code` text
indistinguishable from headings in the rendered buffer.

Introduce a dedicated `MdRenderInlineCode` group:
- fg: inherits from `String` so the existing color cue is preserved
- bg: subtle neutral tint (Comment fg blended with Normal/NormalFloat
  bg at 0.18) — same pattern as `MdRenderImagePlaceholder`, mirroring
  how source-buffer treesitter highlights inline code

Both backtick spans (`restore_code_spans`) and HTML `<code>` tags
(`HTML_TAG_HIGHLIGHTS`) route through the new group.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@delphinus delphinus merged commit da761a0 into main May 15, 2026
0 of 4 checks passed
@delphinus delphinus deleted the feat/inline-code-bg branch May 15, 2026 06:28
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.

1 participant