Skip to content

feature: match icon background when links are in headers #413

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 tasks done
thesimonho opened this issue Apr 25, 2025 · 1 comment
Closed
2 tasks done

feature: match icon background when links are in headers #413

thesimonho opened this issue Apr 25, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@thesimonho
Copy link

Neovim version (nvim -v)

NVIM v0.11.0

Neovim distribution

LazyVim

Operating system

Linux, macOS

Terminal emulator / GUI

Wezterm

Describe the bug

The background color of icons are incorrect when they're for links in headers. For example:

### [Lualine](https://github.com/nvim-lualine/lualine.nvim)

Image

In this case theres an additional issue where the background color seems to extend far beyond the icon/text as well:

### [WezTerm](https://wezfurlong.org/wezterm/) and [WezTerm Tabline](https://github.com/michaelbrusegard/tabline.wez)

Image

(is this second case somehow related to #82, but just coincidentally has the same bg color as the icons?)

Icons work fine for links outside of headers

Expected behavior

Icons should have the same background color as the header

Healthcheck output

render-markdown.nvim [version] ~
- OK plugin 8.3.11
- OK neovim >= 0.11

render-markdown.nvim [configuration] ~
- OK valid

render-markdown.nvim [treesitter] ~
- OK markdown: parser installed
- OK markdown_inline: parser installed
- WARNING latex: parser not installed
  - ADVICE:
    - Disable latex support to avoid this warning
    - require('render-markdown').setup({ latex = { enabled = false } })
- OK html: parser installed
- OK markdown: highlight enabled

render-markdown.nvim [icons] ~
- OK using: mini.icons

render-markdown.nvim [executables] ~
- WARNING latex2text: not installed
  - ADVICE:
    - Disable latex support to avoid this warning
    - require('render-markdown').setup({ latex = { enabled = false } })

render-markdown.nvim [conflicts] ~
- OK headlines: not installed
- OK markview: not installed
- OK obsidian: not installed

Plugin configuration

{
  checkbox = {
    enabled = false
  },
  code = {
    language_pad = 2,
    left_pad = 2,
    min_width = 60,
    right_pad = 1,
    width = "block"
  },
  completions = {
    blink = {
      enabled = true
    }
  },
  file_types = {
    [2] = "Avante"
  },
  heading = {
    border = true,
    icons = { " 󰲡 ", " 󰲣 ", " 󰲥 ", " 󰲧 ", " 󰲩 ", " 󰲫 " },
    position = "inline"
  },
  pipe_table = {
    alignment_indicator = "",
    border = { "",
      [3] = "",
      [7] = "",
      [9] = ""
    },
    preset = "round"
  }
}

Plugin error log

N/A

Confirmations

  • I have updated this plugin to the latest version using my plugin manager
  • I have provided the text contained in all screenshots as raw text in this issue. This means if there is a screenshot below it is the copy pasted contents of the file in the screenshot. I understand that my issue will be closed if I have not.

Additional information

No response

@thesimonho thesimonho added the bug Something isn't working label Apr 25, 2025
@MeanderingProgrammer MeanderingProgrammer added enhancement New feature or request and removed bug Something isn't working labels Apr 25, 2025
@MeanderingProgrammer MeanderingProgrammer changed the title bug: Icon background for links in headers feature: match icon background when links are in headers Apr 25, 2025
MeanderingProgrammer added a commit that referenced this issue Apr 25, 2025
## Details

Request: #413

Link icons are added using inline virtual text. Since we do not set an
`hl_mode` property the default value of `replace` is used. This is fine
in most context but in headings for instance, where we highlight the
background of the line the icons will continue to have their own default
background so will stick out.

The fix for this is to specify `hl_mode = combine` when we add link
icons, which results in the background getting picked up from the
background mark.

Minor other changes:

- Use method name `padding` consistently in renderers rather than
  different ones like `side_padding`, `left_pad`, etc.
- Add an enum for positions in node
- Raise an error when an invalid position is provided to `Node:line`,
  since this is only used internally it would mean there's definitely a
  bug somewhere that we'd otherwise swallow, include the row number in
  the output
@MeanderingProgrammer
Copy link
Owner

Should handle background better after: da3e146

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants