twilight.nvim icon indicating copy to clipboard operation
twilight.nvim copied to clipboard

Better Dimming with Markdown Files?

Open FOSSilizedDaemon opened this issue 4 years ago • 3 comments
trafficstars

I am loving using Twilight, but I have noticed that in markdown files Twilight does not proper see the see the beginning or end of each block. For example here you can see it highlight two blocks instead of just one. Is there anything I can do to get it to only highlight one block?

FOSSilizedDaemon avatar Aug 23 '21 22:08 FOSSilizedDaemon

Have you tried tweaking the context config option?

Hubro avatar May 05 '22 09:05 Hubro

Have you tried tweaking the context config option?

The issue is sometimes I have more than X lines I need to highlight around the current line.

FOSSilizedDaemon avatar Jul 08 '22 18:07 FOSSilizedDaemon

I have also experienced a bit awkward dimming in markdown. I have set context to 0 and you can see results below.

I found out that using tree-sitter playground setting I could provide sensible values to expand option in Twilight config. These three values fix make entire paragraph, code block, and list highlighted.

require("twilight").setup({
  context = 0,
  expand = {
    -- markdown
    "paragraph",
    "fenced_code_block",
    "list",
  }
})

I am a bit concerned about possible naming collision in tree-sitter nodes, but I have no clue if it is a valid concern. If it is, then perhaps expand could be extended to provide values per filetype?

Default config with context = 0

Section and paragraph

Code block

List

TymekDev avatar Aug 29 '22 11:08 TymekDev