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

feature: Syntax highlighting inline code when code preceded by {}

Open Kayzels opened this issue 3 months ago • 0 comments

Is your feature request related to a problem? Please describe.

This isn't particular a problem, just an idea.

It would be cool to have inline code have the colors for the language that it's highlighting. So instead of just being a generic color, if it's detected to be a function, it could get the function color.

This goes against the Markdown spec, so I'd understand not supporting it.

In Obsidian, I've got the Code Styler plugin. One of its features is that you can mark the language used for inline code in squiggly brackets, and it will highlight the code with that language. For example, typing `{html}<html>` would show it as a syntax highlighted html tag.

Describe the solution you'd like

We could possibly use Treesitter injections here to highlight the code appearing in the block after it encounters a known language inside {} at the start, followed by non-whitespace text. If there is no text after the squiggly brackets, just render them directly, and likewise if there is no Treesitter language for what's in the brackets.

Describe alternatives you've considered

I haven't considered alternatives, because this isn't too big of a thing, so I could deal without it, but just thought I'd ask.

Additional information

No response

Kayzels avatar Nov 28 '25 06:11 Kayzels