Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/mercurial/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Documentation 如何向doxygen文档中的隔离代码块添加注释_Documentation_Doxygen - Fatal编程技术网

Documentation 如何向doxygen文档中的隔离代码块添加注释

Documentation 如何向doxygen文档中的隔离代码块添加注释,documentation,doxygen,Documentation,Doxygen,我正在使用markdown语法在Doxygen中使用fenced代码块。这使得添加一个简单的代码示例变得容易,如下所示: ~~~~~{.cpp} void doSomething() { } ~~~~~ 当我尝试使用两个正斜杠向受保护的代码块中添加注释时,Doxygen似乎删除了斜杠。所以当我写这篇文章时: ~~~~~{.cpp} void doSomething() { // This function should do something } ~~~~~

我正在使用markdown语法在Doxygen中使用fenced代码块。这使得添加一个简单的代码示例变得容易,如下所示:

~~~~~{.cpp}
void doSomething()
   {
   }
~~~~~
当我尝试使用两个正斜杠向受保护的代码块中添加注释时,Doxygen似乎删除了斜杠。所以当我写这篇文章时:

~~~~~{.cpp}
void doSomething()
   {
   // This function should do something
   }
~~~~~
我得到这个输出:

void doSomething()
   {
This function should do something
   }
如何让Doxygen将注释保留在隔离代码块中

编辑:

完整的文件如下所示(对于仅文档文件,我们使用标准的Doxygen扩展名.dox):

结果如下所示:

尝试使用\code

  \code{.cpp}
  class Cpp {};
  \endcode

我遇到了同样的问题。无需更改代码格式。您可以将
STRIP\u code\u COMMENTS
指定为
NO
:此设置输出带有注释的源代码

# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
# special comment blocks from generated source code fragments. Normal, C++ and
# Fortran comments will always remain visible.
# The default value is: YES.

STRIP_CODE_COMMENTS    = NO

你能说明上面的标记是如何嵌入到注释块或.md文件中的吗?我已经在问题中添加了完整的文件内容。这确实有效。我知道\代码存在,但我不知道您可以在它后面添加{.cpp}。然而,{.cpp}似乎没有什么不同。我用一个小的for循环测试了它,它似乎只给“for”关键字上色。所有其他单词(vector、int、push_back、main)仍以黑色显示。幸运的是,注释可以正确地使用它(并且它们也是彩色的)。
# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
# special comment blocks from generated source code fragments. Normal, C++ and
# Fortran comments will always remain visible.
# The default value is: YES.

STRIP_CODE_COMMENTS    = NO