代码块中的多行注释不会出现在 README.md 中
我目前正在记录如何在我的一个项目中记录代码,为此,我正在编写一份 README.md 文档,我将其作为使用 Doxygen 1.8.13 生成的文档的首页。
我尝试将一些示例作为代码块放在 README 中,但是 Doxygen 使用的注释是多行注释,并且代码块在生成 Markdown 页面时似乎会跳过多行注释。
这是所发生情况的示例。
这就是我想要的:
/** @def MACRO
* @brief Short description of the macro MACRO
*/
#define MACRO 0
这是我必须为代码块的出现而编写的内容(“@”符号似乎有问题):
/** \@def MACRO
* \@brief Short description of the macro MACRO
*/
#define MACRO 0
这是我用代码生成文档时得到的结果上面的块:
#define MACRO 0
我知道多行注释会出现在代码块中,而无需指定代码块的语言(编写三个反引号“`”而不是三个反引号和 c),但我想继续突出显示C代码。
你知道如何解决“@”的问题吗?最重要的是,你知道是否有办法让多行注释出现在代码块中,同时保持 C 代码的突出显示?
先感谢您!
I am currently documenting how to document code on one of my projects, and to do so I am writing a README.md document that I am putting as frontpage of the documentation that I generate using Doxygen 1.8.13.
I tried to put some examples inside the README as code blocks, but the comments used by Doxygen are multiline comments and the code blocks seem to skip the multiline comments when generating the Markdown page.
Here is an example of what happens.
This is what I would like to have:
/** @def MACRO
* @brief Short description of the macro MACRO
*/
#define MACRO 0
This is what I have to write for the code block to appear (there seems to be issues with the "@" symbol):
/** \@def MACRO
* \@brief Short description of the macro MACRO
*/
#define MACRO 0
This is the result I get when I generate the documentation with the code block right above:
#define MACRO 0
I know that the multiline comments would appear in the code blocks without specifying the language of the code block (writing three backticks "`" instead of three backticks and c), but I would like to keep highlighting the syntax of the C code.
Do you know how to solve the problem with the "@", and most importantly do you know if there is a way for the multiline comments to appear in the code blocks whilst keeping the highlighting of C code?
Thank you in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当我有以下源文件
Readme.md
:和 doxygen 设置 (
Doxyfile
):我得到 1.9.3 (c0b9eafbfb53286ce31e75e2b6c976ee4d345473) 版本时,我得到:
因此,从问题来看,我认为这是必需的(当不添加确切的代码时) (作为文本)以及原始问题中的结果输出)。
如果想要像
C
代码一样渲染它,应该使用反引号:```c
并且还应该设置STRIP_CODE_COMMENTS=NO
否则评论将不会显示。执行此操作时,我得到:
When I have the following source file
Readme.md
:and doxygen settings (
Doxyfile
):I get with the 1.9.3 (c0b9eafbfb53286ce31e75e2b6c976ee4d345473) version, I get:
So from the question I think this is required (when not add exact code (as text) and the resulting output in the original question).
In case one wants to render it like
C
code one should use for the opening backticks:```c
and one should also setSTRIP_CODE_COMMENTS=NO
otherwise the comment will not be shown.When doing this I get: