How to generate inline code section with Doxygen?

kakyo picture kakyo · Jul 12, 2013 · Viewed 8.5k times · Source

My narration has code snippets, e.g., ::SomePlatformAPI() that are not part of my code base and Doxygen warns that

warning: explicit link request to 'SomePlatformAPI()' could not be resolved

I tried to add \code and \endcode around it but then the code block starts a new paragraph and breaks the current narration.

Is there a way to add inline code blocks?

UPDATE:

This turns out to be only a problem of Doxygen 1.8 and above. With 1.6, you don't have this issue.

Answer

Nick picture Nick · Mar 13, 2014

Doxygen markdown support allows you to insert inline code blocks using the ` backtick character. http://www.doxygen.nl/manual/markdown.html#md_codespan

When you do this the code will be injected inline, but it will be monospaced, and doxygen processing will be disabled between the two ` marks. So you will not have to escape tokens.

A a matter of fact, to make it stand out even more I included an extra style sheet with the following in it:

code
{
    background-color:#EFD25E;
}

That will hylight the inline code. Doxygen's code spans use a custom tag

<code></code>