Skip to main content
`Ctrl`+`K`

# Commenting in doxygen

You can use rst snippets in all supported doxygen comment styles.

The rst snippets just need to be fenced with the alias tags `rst` and `endrst`. However do not nest `rst` fences. This won’t work.

Depending on your preference you can use `@rst` and `@endrst` or `\rst` and `\endrst`.

Here are some examples (for further examples see doxysphinx::doxygen::CommentStyles).

## Javadoc Comments

### Variant A - with asterisks

    /**
     *\rst
     * .. info
     *    as you can see you can just use directives and anything here
     *
     * also just normal text blocks.
     * Everything inbetween \rst and \endrst will be treated like a normal rst file.
     *\endrst
     */
     void test() const;

### Variant B - without asterisks

    /**
     \rst
             .. admonition:: Another info

                The indentation will be normalized automatically by doxysphinx.
                However as with any other rst file you should stick to the sphinx indentation rules.

     \endrst
     */
     void test() const;

## Qt-Style Comments

### Variant A - with asterisks

    /*!
     *\rst
     * .. info
     *    Qt-style comments also work.
     *\endrst
     *\/
     void test() const;

### Variant B - without asterisks

    /*!
     *\rst
     *      .. info
     *         Qt-style comments without asterisk and indentation also work
     *\endrst
     *\/
     void test() const;

## Slash Comments

### Variant A - tripple slashes (microsoft style)

    /// @rst
    ///
    /// ...rst-content-here...
    ///
    /// @endrst
    void test() const;

### Variant B - double slash exclamation mark

    //! @rst
    //!
    //!         ...rst-content-here...
    //!
    //! @endrst
    void test() const: