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

help: change wikilinks higlights (and code block icon colors)

Open petobens opened this issue 1 year ago • 3 comments
trafficstars

Neovim version (nvim -v)

NVIM v0.11.0-dev-959+g4b90952851

Neovim distribution

None

Description

Hi! I'm trying to change wikilink highlights but the following regex fails:

    link = {
        custom = {
            wiki = {
                -- FIXME: Not working
                pattern = '(%[%[[^%]]+%]%])',
                icon = '󰌹 ',
                highlight = 'RenderMarkdownWiki',
            },
        },
    },

Any pointers?

Also is it possible to avoid having colors in code blocks icons? I.e I would like the icon python bit not to be in yellow in the following image: image

petobens avatar Oct 12 '24 14:10 petobens

Added these as features here: https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/965c222076b2d289ed498730845d533780f3c7c7.

Use link.wiki.icon & link.wiki.highlight to modify WikiLink behavior rather than a custom pattern. The default values are:

require('render-markdown').setup({
  link = {
    wiki = { icon = '󱗖 ', highlight = 'RenderMarkdownWikiLink' },
  },
})

For the code language I still need some highlight in order to render these so I added code.highlight_language which lets you override the value from the icon provider. For example:

require('render-markdown').setup({
  code = {
    highlight_language = 'LineNr',
  },
})

MeanderingProgrammer avatar Oct 12 '24 22:10 MeanderingProgrammer

Use link.wiki.icon & link.wiki.highlight to modify WikiLink behavior rather than a custom pattern

Brilliant!

so I added code.highlight_language

This is perfect. One minor question/request: is it possible to show the icon without the language name? i.e just the icon

petobens avatar Oct 12 '24 23:10 petobens

Sure, added here: https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/18c7ef71fb4b8d83cb0160adc9127fc4d65ca42e

Set code.language_name to false:

require('render-markdown').setup({
  code = {
    language_name = false,
  },
})

MeanderingProgrammer avatar Oct 13 '24 05:10 MeanderingProgrammer

Thank you! Feel free to close this issue.

petobens avatar Oct 13 '24 12:10 petobens