-
Notifications
You must be signed in to change notification settings - Fork 49
feature: custom heading icons depending on filetype #320
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
This plugin already supports this behavior, through the For example to set custom heading icons for require('render-markdown').setup({
overrides = {
filetype = {
codecompanion = {
heading = { icons = { 'h1_icon', 'h2_icon', 'h3_icon', 'h4_icon', 'h5_icon', 'h6_icon' } },
},
},
},
}) At the The reason for the kind of convoluted nested structure is we allow |
Oh that's great! And triggers a follow-up question: is it possible to have different icons and colors for a same H2 heading depending on the H2 title? i.e adding some sort of pattern/regex that changes the icon depending on such pattern. For instance now with your suggested change I can do: overrides = {
filetype = {
codecompanion = {
heading = {
icons = { ' ', ' ', ' ', ' ', ' ', '' },
},
},
},
} And get: I would like i) to have an icon for when the H2 text is |
That is currently not possible, will see about adding it as a feature :) |
## Details Request: #320 The desired feature was some way to change the icon, foreground, and background for a heading based on the text of the heading. To accomplish have added a new configuration under `heading` called `custom` which functions very similarly to custom links. Users define a `pattern` which will be matched against the heading text and if it does we will use the `icon`, `foreground`, & `background` (if provided) from the matching custom configuration instead of the top level values. For example: ```lua require('render-markdown').setup({ heading = { custom = { codecompanion_me = { pattern = '^## Me$', icon = 'some_icon', foreground = 'some_highlight', background = 'some_highlight', }, }, }, }) ```
Added this feature here: 5c2440d It's pretty similar to what you suggested but not at the As an example: require('render-markdown').setup({
heading = {
custom = {
codecompanion_me = {
pattern = '^## Me$',
icon = 'some_icon',
foreground = 'some_highlight',
background = 'some_highlight',
},
},
},
})
|
This is fantastic. Thank you :) I didn't get this bit though: |
I was referring to the overrides filetype thing I mentioned earlier, as opposed to an ft option in the custom headings. |
Is your feature request related to a problem? Please describe.
Currently we can define heading icons like:
and enable render-markdown for filetypes by doing
Describe the solution you'd like
I was wondering whether it would be possible to add the ability to have different heading icons per filetype. In particular I'm using render-markdown with codecompanion ai plugin. The codecompanion markdown chat ui buffer looks like:
where the light blue headers are simply markdown
H2
headers. I would love to be able to do something similar to checkbox/links icons for markdown headings:Describe alternatives you've considered
Additional information
No response
The text was updated successfully, but these errors were encountered: