How can I hightlight markdown in doxygen under vim

2019-02-28 03:11发布

问题:

The newer version of doxygen comes with markdown support. Is there an easy way to add markdown syntax highlight to a doxygen comment block in vim?

On a side note, one can add doxygen syntax to a c file by using set filetype=c.doxygen

回答1:

To do this right, the Doxygen syntax extension script would need to be extended to support Markdown syntax, either by duplicating the syntax, or by defining regions that can include Markdown and using :syntax include syntax/markdown.vim to include the syntax. Please contact the syntax plugin's owner with such a request, or even send a patch.

For a pragmatic approach that you can immediately use, my SyntaxRange plugin provides a command that can highlight certain ranges with a different syntax:

:3,11SyntaxInclude markdown

With this (possibly aided by a custom mapping to make this faster), you can highlight Doxygen-Markdown ranges on demand (e.g. when the text markup is so complex that you would have the comfort of proper syntax highlighting).