Skip to content

Commit

Permalink
feature: Add separate backgrounds for H3-H6 instead of sharing
Browse files Browse the repository at this point in the history
## Details

Requested: #70
  • Loading branch information
MeanderingProgrammer committed Jul 19, 2024
1 parent 634f003 commit 6aa19e9
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 13 deletions.
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,14 @@ require('render-markdown').setup({
signs = { '󰫎 ' },
-- The 'level' is used to index into the array using a clamp
-- Highlight for the heading icon and extends through the entire line
backgrounds = { 'RenderMarkdownH1Bg', 'RenderMarkdownH2Bg', 'RenderMarkdownH3Bg' },
backgrounds = {
'RenderMarkdownH1Bg',
'RenderMarkdownH2Bg',
'RenderMarkdownH3Bg',
'RenderMarkdownH4Bg',
'RenderMarkdownH5Bg',
'RenderMarkdownH6Bg',
},
-- The 'level' is used to index into the array using a clamp
-- Highlight for the heading and sign icons
foregrounds = {
Expand Down Expand Up @@ -414,7 +421,14 @@ require('render-markdown').setup({
signs = { '󰫎 ' },
-- The 'level' is used to index into the array using a clamp
-- Highlight for the heading icon and extends through the entire line
backgrounds = { 'RenderMarkdownH1Bg', 'RenderMarkdownH2Bg', 'RenderMarkdownH3Bg' },
backgrounds = {
'RenderMarkdownH1Bg',
'RenderMarkdownH2Bg',
'RenderMarkdownH3Bg',
'RenderMarkdownH4Bg',
'RenderMarkdownH5Bg',
'RenderMarkdownH6Bg',
},
-- The 'level' is used to index into the array using a clamp
-- Highlight for the heading and sign icons
foregrounds = {
Expand Down Expand Up @@ -658,7 +672,10 @@ The table below shows all the highlight groups with their default link
| RenderMarkdownH6 | @markup.heading.6.markdown | H6 icons |
| RenderMarkdownH1Bg | DiffAdd | H1 background line |
| RenderMarkdownH2Bg | DiffChange | H2 background line |
| RenderMarkdownH3Bg | DiffDelete | H3-H6 background line |
| RenderMarkdownH3Bg | DiffDelete | H3 background line |
| RenderMarkdownH4Bg | DiffDelete | H4 background line |
| RenderMarkdownH5Bg | DiffDelete | H5 background line |
| RenderMarkdownH6Bg | DiffDelete | H6 background line |
| RenderMarkdownCode | ColorColumn | Code block background |
| RenderMarkdownBullet | Normal | List item bullet points |
| RenderMarkdownQuote | @markup.quote | Block quote marker |
Expand Down
26 changes: 23 additions & 3 deletions doc/render-markdown.txt
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,14 @@ Full Default Configuration ~
signs = { '󰫎 ' },
-- The 'level' is used to index into the array using a clamp
-- Highlight for the heading icon and extends through the entire line
backgrounds = { 'RenderMarkdownH1Bg', 'RenderMarkdownH2Bg', 'RenderMarkdownH3Bg' },
backgrounds = {
'RenderMarkdownH1Bg',
'RenderMarkdownH2Bg',
'RenderMarkdownH3Bg',
'RenderMarkdownH4Bg',
'RenderMarkdownH5Bg',
'RenderMarkdownH6Bg',
},
-- The 'level' is used to index into the array using a clamp
-- Highlight for the heading and sign icons
foregrounds = {
Expand Down Expand Up @@ -453,7 +460,14 @@ HEADINGS *render-markdown-setup-headings*
signs = { '󰫎 ' },
-- The 'level' is used to index into the array using a clamp
-- Highlight for the heading icon and extends through the entire line
backgrounds = { 'RenderMarkdownH1Bg', 'RenderMarkdownH2Bg', 'RenderMarkdownH3Bg' },
backgrounds = {
'RenderMarkdownH1Bg',
'RenderMarkdownH2Bg',
'RenderMarkdownH3Bg',
'RenderMarkdownH4Bg',
'RenderMarkdownH5Bg',
'RenderMarkdownH6Bg',
},
-- The 'level' is used to index into the array using a clamp
-- Highlight for the heading and sign icons
foregrounds = {
Expand Down Expand Up @@ -717,7 +731,13 @@ The table below shows all the highlight groups with their default link

RenderMarkdownH2Bg DiffChange H2 background line

RenderMarkdownH3Bg DiffDelete H3-H6 background line
RenderMarkdownH3Bg DiffDelete H3 background line

RenderMarkdownH4Bg DiffDelete H4 background line

RenderMarkdownH5Bg DiffDelete H5 background line

RenderMarkdownH6Bg DiffDelete H6 background line

RenderMarkdownCode ColorColumn Code block background

Expand Down
3 changes: 3 additions & 0 deletions lua/render-markdown/colors.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ M.colors = {
H1Bg = 'DiffAdd',
H2Bg = 'DiffChange',
H3Bg = 'DiffDelete',
H4Bg = 'DiffDelete',
H5Bg = 'DiffDelete',
H6Bg = 'DiffDelete',
-- General
Code = 'ColorColumn',
Bullet = 'Normal',
Expand Down
9 changes: 8 additions & 1 deletion lua/render-markdown/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,14 @@ M.default_config = {
signs = { '󰫎 ' },
-- The 'level' is used to index into the array using a clamp
-- Highlight for the heading icon and extends through the entire line
backgrounds = { 'RenderMarkdownH1Bg', 'RenderMarkdownH2Bg', 'RenderMarkdownH3Bg' },
backgrounds = {
'RenderMarkdownH1Bg',
'RenderMarkdownH2Bg',
'RenderMarkdownH3Bg',
'RenderMarkdownH4Bg',
'RenderMarkdownH5Bg',
'RenderMarkdownH6Bg',
},
-- The 'level' is used to index into the array using a clamp
-- Highlight for the heading and sign icons
foregrounds = {
Expand Down
7 changes: 1 addition & 6 deletions tests/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,7 @@ M.prefix = 'RenderMarkdown'
M.heading = function(row, level)
local icons = { '󰲡 ', ' 󰲣 ', ' 󰲥 ', ' 󰲧 ', ' 󰲩 ', ' 󰲫 ' }
local foreground = string.format('%sH%d', M.prefix, level)
local background
if level < 3 then
background = string.format('%sH%dBg', M.prefix, level)
else
background = string.format('%sH3Bg', M.prefix)
end
local background = string.format('%sH%dBg', M.prefix, level)
local sign_mark = {
row = { row, row },
col = { 0, level },
Expand Down

0 comments on commit 6aa19e9

Please sign in to comment.