views:

269

answers:

1

In relation to this question, I was wondering if anyone knows a javascript code snippet/library to convert a single doxygen comment to HTML?

For example,

/** This is a comment block
 *
 * \b bold text
 * \i italic text
 */

would be converted to something like:

<p>This is a comment block</p>
<p><b>bold</b> text</p>
<p><i>italic</i> text</p>

Similar for all the other formatting related tags of doxygen.

I've found this already, which seems to be a good starting point if I have to implement it myself, but possibly I'm missing a complete project :-)

So, suggestions welcome!

A: 

Leveraging an existing tool/codebase that does at least part of what you want is your best bet. Parsing is not an easy problem, especially finding Doxygen comments in code, particularly if you're handling multiple languages. A quick search didn't turn up any terribly obvious projects, but if you're willing to create your own if need be, I'd suggest starting with the Doxygen codebase itself. It's open-source, and available via SVN or direct download. Bear in mind that Doxygen is written in C++, but if you can follow the parser's actions (perhaps only for a specific language) it could save you tons of work and prevent missing corner cases, etc. It all depends on how robust you want your solution to be, and if it will be only you using it, or if you may end up supporting it for others. Good luck!

Quinn Taylor