doxygen \code 标签在同一页面上打断 html 标签

doxygen \code tag breaks html tags on the same page

这是我在这里的第一个问题。

当我使用 doxygen 记录我的 C++ 代码时,我遇到了一个奇怪的问题。一旦我在页面上有一个 \code 标签,所有 html 标签都不会在输出中处理。

第一个示例显示了我对 html 标签的预期。在第二个例子中,我只是添加了一个 doxygen \code 标签,完整的输出是损坏的。

示例 1:

//!   \page testpage Test Page
//!
//!   <ul>
//!     <li>\ref test_section1</li>
//!     <li>\ref test_section2</li>
//!   </ul>
//!
//!   \section test_section1 Test Section 1
//!
//!   Any text.
//!
//!   \section test_section2 Test Section 2
//!
//!   Any text.
//!   <br><br>

doxygen result of the first example

示例 2:

//!   \page testpage Test Page
//!
//!   <ul>
//!     <li>\ref test_section1</li>
//!     <li>\ref test_section2</li>
//!   </ul>
//!
//!   \section test_section1 Test Section 1
//!
//!   Any text.
//!
//!   \code
//!   if (x==1) return;
//!   \endcode
//!
//!   \section test_section2 Test Section 2
//!
//!   Any text.
//!   <br><br>

doxygen result of the second example

顺便说一句,我在 linux.

上使用 doxygen 1.8.5

使用当前版本的 doxygen (1.8.12) 解决问题。

在doxygen配置文件(Doxyfile)中禁用Markdown支持(MARKDOWN_SUPPORT = NO)可以在1.8.5中获得更好的结果。

使用如下形式的代码也可以获得不错的效果:

    /**
   \page testpage2 Test2 Page

   <ul>
     <li>\ref test_section1</li>
     <li>\ref test_section2</li>
   </ul>

   \section test_section1 Test Section 1

   Any text.

   \code
   if (x==1) return;
   \endcode

   \section test_section2 Test Section 2

   Any text.
   <br><br>
*/

这与 MARKDOWN_SUPPORT 的设置无关。

建议还是使用当前版本 (1.8.12)。