Skip to content

fix(highlight): carry over bg from treesitter heading hl#16

Merged
delphinus merged 1 commit into
mainfrom
fix/heading-bg
May 15, 2026
Merged

fix(highlight): carry over bg from treesitter heading hl#16
delphinus merged 1 commit into
mainfrom
fix/heading-bg

Conversation

@delphinus
Copy link
Copy Markdown
Owner

Summary

  • setup_heading_highlights only copied fg from @markup.heading.<level>.markdown, silently dropping bg (and other attributes like italic/underline).
  • Colorschemes that paint a heading background — tokyonight is the obvious one, with a distinct bg per level — rendered with bg in the source buffer but not in the md-render preview buffer.
  • Now the full resolved attribute table is carried over. bold = true is still forced as a fallback for colorschemes that omit it.

Verified under tokyonight: all 6 MdRenderH<level> groups now resolve to both fg and bg (e.g. H3 = fg=#c3e88d bg=#32383f bold=true).

Test plan

  • make test (no behavioral test changes; 515 passed)
  • Manual: open a README under tokyonight in :MdRenderSplit and confirm headings now have a bg matching the source side

🤖 Generated with Claude Code

setup_heading_highlights only copied fg from
@markup.heading.<level>.markdown, dropping bg and other attributes.
Colorschemes that paint a heading background (e.g. tokyonight defines
distinct bg per level) appeared with bg in the source buffer but not
in the preview buffer.

Now copy the full attribute table from the resolved treesitter hl, so
bg, italic, underline, etc. all propagate. bold = true is still forced
as a fallback for colorschemes that omit it.

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