Alex Rivera | Logout

Doxygen: \code tag kills indentation

Asked 2012-06-25T14:04:20.077
12

In doxygen I write:

/*! Sample:

\code{.cpp}
void main(int argc, char** argv)
{
    if (argc < 2)
    {
        cout << "no way!" << endl;
    }
    else
    {
        foobar(argv[1]);
    }
}
\endcode
*/

Now doxygen will generate a perfectly syntax-highlighted code sample for my documentation, but unfortunately it also kills the indentation:

Sample:

void main(int argc, char** argv)
{
if (argc < 2)
{
cout << "no way!" << endl;
}
else
{
foobar(argv[1]);
}
}

What can I do to make doxygen respect my indentation. I know there is \verbatim, but it does not highlight the syntax.


EDIT: Here's the doxygen configuration, perhaps there's something wrong in there:

#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING      = UTF-8
PROJECT_NAME           = demo
PROJECT_NUMBER         = 
PROJECT_BRIEF          = 
PROJECT_LOGO           = 
OUTPUT_DIRECTORY       = ../../../../../Desktop/dox
CREATE_SUBDIRS         = NO
OUTPUT_LANGUAGE        = English
BRIEF_MEMBER_DESC      = YES
REPEAT_BRIEF           = YES
ABBREVIATE_BRIEF       = "The $name class" \
                         "The $name widget" \
                         "The $name file" \
                         is \
                         provides \
                         specifies \
                         contains \
                         represents \
                         a \
                         an \
                         the
ALWAYS_DETAILED_SEC    = NO
INLINE_INHERITED_MEMB  = NO
FULL_PATH_NAMES        = NO
STRIP_FROM_PATH        = 
STRIP_FROM_INC_PATH    = 
SHORT_NAMES            = NO
JAVADOC_AUTOBRIEF      = YES
QT_AUTOBRIEF           = NO
MULTILINE_CPP_IS_BRIEF = YES
INHERIT_DOCS           = YES
SEPARATE_MEMBER_
Edit
Report

1 Answer

9

If you are using Doxygen 1.8.1.1 or older the indentation will be respected. Doxygen Release 1.8.1.2 removes leading indentation shared by the @code lines. Check the Change log released on 12-07-2012.

answered 2012-07-30T15:08:09.220

Your Answer