vim-flavored-markdown
vim-flavored-markdown copied to clipboard
Syntax Highlighting in Raw Markdown
I'd like my fenced code to be syntax highlighted even while in raw-mode. Is there already way to have this, or would this be a new feature? This feature doesn't even seem to exist for plain markdown code blocks.
This would definitely be a new feature. As somewhat covered in #14 , doing this dynamically either isn't possible or is beyond what I understand how to do this in vimscript.
If you want to have multiple kinds of highlighting, you can check out what people have done with HTML (where script blocks get highlighted as javascript). This requires explicitly including javascript syntax within it and using regular expressions to mark where js code blocks are defined. So if you knew you were going to always have Python codeblocks, then you could detect "```python" and do something intelligent from there. I'm not sure it's possible to do it in the general case (since you'd want to be able to trigger a syntax command call when you saw that pattern and I don't think syntax files allow you to dynamically run code triggered by a block)
That said, if you figure something out I'd be eager to try it.
I still consider myself a novice vimmer, but I do know that vimwiki has this feature; they call it nested syntaxes.
nested syntax is what I was referring to - but I don't think it's possible to have dynamic nested syntaxes, right?
I don't fully understand what you mean by dynmacially, but in vimwiki if you have a line:
{{{xml
all subsequent line of code until a closing }}} will be highlighted as xml.