-
Notifications
You must be signed in to change notification settings - Fork 61
feature: Different colors in Nested Quotes #404
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
Comments
## Details Request: #404 While the request seems to be about using the parent color across the board, I've instead implemented this in a slightly more complex but hopefully more pretty way. Rather than highlighting entire sets of `block quote` markers, i.e. `> > >`, with a single highlight we now associate colors based on the level of the block quote. What this means is if we're into a triple nested block quote where: - Level 1: `[!IMPORTANT]` callout - Level 2: no callout - Level 3: `[!BUG]` callout We'll use highlight as follows: - `>` 1: `[!IMPORTANT]` callout highlight - `>` 2: default `quote` highlight - `>` 3: `[!BUG]` callout highlight This applies throughout the `block quote` on all lines. To handle the `lazy` provision of the `markdown` spec we simply go front to back one level at a time. So if on some line `> >` is added even though the level is still technically 3, we only highlight the first 2 according to the first 2 levels. So as not to limit the usage to callouts `quote.icon` and `quote.highlight` now both support taking a list of strings in addition to a single string value. When a list is provided it is indexed into using a `cycle` access pattern based on the nesting of the current `block quote`. This allows users to change both the color and the icon used based on how deeply nested the block quote is. Add unit tests for updated quote logic since it's not trivial.
Added support for this here: 7f75b16 Unsure if it's what you were looking for but nested colors should be handled a lot better for block quotes in general. Please update and LMK what you think! |
This is cool and good. But I was asking for something more (sorry for being kinda rude). Here is what I think would be even better (Totally a personal opinion). The Quote 0 is fine with what color text color it has (block --> Blue, text --> red). First I was thinking of having different color for all the nested blocks (i.e. Q0 blue, Q1 Pink, Q2 green), but that will be more distracting to look and other type of quotes has different colors ( And as the nested blocks are red in color that's why the labels like Either way thank you for this feature. It looks more nicer than before. |
I think I see what you're getting at but lmk if I'm not understanding something. In the commit with this change I also enabled the Out of the box I still just set the single color but on your end you can create whatever highlight groups you like and set them in the configuration. Or you can use some rainbow highlights plugin, completely up to you. Would look something like: {
'MeanderingProgrammer/render-markdown.nvim',
dependencies = {
'nvim-treesitter/nvim-treesitter',
'echasnovski/mini.nvim',
},
config = function()
vim.api.nvim_set_hl(0, 'MarkdownQuote1', { fg = 'some-dark-red' })
vim.api.nvim_set_hl(0, 'MarkdownQuote2', { fg = 'some-lighter-red' })
vim.api.nvim_set_hl(0, 'MarkdownQuote3', { fg = 'some-other-red' })
require('render-markdown').setup({
quote = {
highlight = {
'MarkdownQuote1',
'MarkdownQuote2',
'MarkdownQuote3',
},
},
})
end,
} LMK if that's what you were looking for! |
There's not a good set of values to set out of the box, since it depends entirely on your colorscheme. I did however make a change that'll let color scheme authors set this up out of the box here: 7051859. So within each color scheme you can now set whatever values make sense for the highlight groups By default all of these still link to |
Uh oh!
There was an error while loading. Please reload this page.
Is your feature request related to a problem? Please describe.
Nested Quotes don't have different colors from the parent nested quote (It will be nice to have a feature like this).
And Also the parent quote inherit the color of the 2nd nested quote (2nd onwards there is no different color).
Here is what I said
Describe the solution you'd like
If nested quotes have different color while nested and does not affect the parent quote icon color it'll be nice (I guess).
Describe alternatives you've considered
I only use this for markdown rendering, hence I could not find any alternative what so ever.
Additional information
No response
The text was updated successfully, but these errors were encountered: