vim-flavored-markdown icon indicating copy to clipboard operation
vim-flavored-markdown copied to clipboard

Show appropriate nested highlighting for code blocks

Open jtratner opened this issue 11 years ago • 4 comments

I'm working on adding a little mini-plugin to appropriately highlight other languages within code blocks. Right now it's in the planning stages, but since a few other people have been submitting pull requests here and there, I figured I'd leave a note to see if anyone's interested.

This StackOverflow post has a good rundown of how to do it, but I'm guessing that you can't just include arbitrary languages (i.e., ````somelanguageuses the highlighting forsomelanguage`).

I see three main options:

  1. Add a set of include commands for common languages. (but if it causes it to load the entire syntax file for that language when you load this syntax file, then we can't load too many languages with it).
  2. Add a command that searches the doc for matches to ````somelanguage` and loads those into the syntax file.
  3. Do (2), but instead of requiring command to be invoked manually, have it activate when ````somelanguage` is typed.

If anybody has suggestions for how to proceed, I'd be interested to hear them.

jtratner avatar Mar 17 '13 03:03 jtratner

ReST syntax appears to do this or might try to dynamically define based on globals or something...

jtratner avatar Jun 24 '13 03:06 jtratner

@jtratner this is very interesting. Any progress on this topic?

chikamichi avatar Mar 18 '14 14:03 chikamichi

I agree, it would be interesting to do - I'm not sure it's really feasible to do dynamically because of how vim handles syntax highlighting (you'd probably have to dynamically construct a syntax file to apply).

If you have any thoughts on how this might work, that'd be useful to hear.

jtratner avatar Mar 18 '14 15:03 jtratner

I have absolutely no idea on how to do it, but I would love to have such a feature!

Jerska avatar Jul 02 '15 20:07 Jerska