1

I write a lot of C/C++ and get highlighting for my Doxygen docs in my comments. It's not perfect, but it sure helps avoiding many very simple mistakes on the spot.

To handle that, I simply have the following in my own c.vim file:

source $VIMRUNTIME/syntax/cpp.vim
source $VIMRUNTIME/syntax/doxygen.vim

Now I'm writing a lot of Node.js code and thus I'm writing jsdoc docs. Is there a way to get the comments highlighted with markdown?

I tried the following after loading a JS file and nothing happened:

source $VIMRUNTIME/syntax/markdown.vim

which I'm not surprised because markdown doesn't expect to mark things in comments...

Is there a ready made solution or would it require extending the JavaSript highlighting to support the jsdoc syntax?


Here is an example of comment where I would like to get markdown highlighting (or even better, jsdoc and markdown)

/**
 * Check whether `value` represents a valid filename.
 *
 * This function checks whether `value` represents a valid filename.
 * The `param` option is used to determine which type of check you
 * want to perform with `value`.
 *
 * Here are the currently supported `param` values:
 *
 * * `exists` -- whether that file currently exists.
 *
 * @todo
 * Look into local filenames handling.
 *
 * @param {any} value  The value being checked.
 * @param {string} param  The type of test on `value`.
 *
 * @returns true if the value is considered valid.
 *
 * @private
 */
2
  • @D.BenKnoble I'm wondering whether a cluster can auto-remove the ` * ` from the left side... I guess I'll update my question with that detail. Jan 15 '19 at 3:28
  • Not sure this is a duplicate. Here we have the leading ` * ` and also javascript syntax would need to include markdown, which includes html, which includes javascript. And there is also markdowns g:markdown_fenced_languages.
    – Ralf
    Jan 15 '19 at 9:32