Skip to content
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

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

Closed
petobens opened this issue Oct 12, 2024 · 4 comments
Closed

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

petobens opened this issue Oct 12, 2024 · 4 comments
Labels
question Further information is requested

Comments

@petobens
Copy link

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 petobens added the question Further information is requested label Oct 12, 2024
MeanderingProgrammer added a commit that referenced this issue Oct 12, 2024
## Details

Request: #205

Add `link.wiki` config where users can specify icon and highlight group.
Adds a `RenderMarkdownWikiLink` highlight which links to `RenderMarkdownLink`
so nothing but the icon should change out of the box.

Allow users to specify `code.highlight_language` which overrides the
value from the icon provider.

Minor other changes:

- Remove logging of uncaptured groups, are no longer configurable
- Refactor `markdown_inline` parser into separate renderers for inline
  code, links, and shortcuts
- Change `render_modes` for `obsidian` preset to all modes, i.e. `true`
@MeanderingProgrammer
Copy link
Owner

Added these as features here: 965c222.

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',
  },
})

@petobens
Copy link
Author

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

MeanderingProgrammer added a commit that referenced this issue Oct 13, 2024
## Details

Request: #205

Adds `code.language_name` argument which when false will not render the
language name next to the icon. Defaults to true to keep current
behavior unchanged.
@MeanderingProgrammer
Copy link
Owner

Sure, added here: 18c7ef7

Set code.language_name to false:

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

@petobens
Copy link
Author

Thank you! Feel free to close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants