Skip to content

feat: opt-in linked/semantic highlight mode #34

@TyceHerrman

Description

@TyceHerrman

Could helpview.nvim provide an opt-in linked/semantic highlight mode where built-in Helpview* groups link to standard Neovim, Tree-sitter, or vimdoc highlight groups instead of generating concrete fg/bg values?

The current dynamic highlight system should remain the default.

The use case is users and colorscheme authors may want colorscheme-owned Helpview colors without copying or predefining a large set of HelpviewPalette* groups. A linked mode would make Helpview decorations inherit from semantic highlight groups directly, so colorschemes can control the final appearance through the groups they already define.

Naming is not important, but something like this could be enough:

require("helpview").setup({
  highlights = {
    style = "linked", -- default could stay "dynamic"
  },
})

or:

require("helpview").setup({
  highlight_style = "linked",
})

Exact mappings tbd, but as an example

HelpviewPalette0Fg = { link = "Comment" },
HelpviewPalette1Fg = { link = "@markup.heading.1.markdown" },
HelpviewPalette2Fg = { link = "@markup.heading.2.markdown" },
HelpviewPalette3Fg = { link = "@markup.heading.3.markdown" },
HelpviewPalette4Fg = { link = "@markup.heading.4.markdown" },
HelpviewPalette5Fg = { link = "@markup.heading.5.markdown" },
HelpviewPalette6Fg = { link = "@markup.heading.6.markdown" },
HelpviewPalette7Fg = { link = "@keyword" },

HelpviewCode = { link = "NormalFloat" },
HelpviewCodeInfo = { link = "Comment" },
HelpviewInlineCode = { link = "@markup.raw" },
HelpviewTaglink = { link = "@markup.link.vimdoc" },
HelpviewOptionlink = { link = "@markup.link.vimdoc" },
HelpviewKeycode = { link = "@string.special.vimdoc" },
HelpviewArgument = { link = "@variable.parameter.vimdoc" },

For groups where Helpview currently computes background variants, linked mode could either link to foreground-only groups or use conservative defaults like NormalFloat, Pmenu, Visual, or CursorLine.

This would let colorschemes integrate with Helpview without duplicating Helpview's generated palette logic. It would also give users a neutral fallback when they prefer their colorscheme to own all plugin UI colors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions