繁体   English   中英

如何将 Doxygen xml output 渲染为 markdown 而不是 Z071B810684D570814BC345B8B8B

[英]How to render Doxygen xml output into markdown instead of reST (using breathe or MyST-Parser)

我正在使用Sphinx准备一个项目文档,在 where fetch Doxygen XML output 用过 Breath 。 我在.rst文件中使用了呼吸指令。

sample.cpp

namespace X{
class A{
   public:
       int x;
};
}

在我刚刚添加的rst文件中

.. doxygenclass:: X::A
   :members:
   :protected-members:
   :private-members:

构建项目后,我可以看到class A详细文档。 出于某种原因,我打算使用markdown文件而不是.rst

我浏览了几篇帖子,但找不到任何富有成效的答案。 我得到这个 StackOverflow 答案的最好的一个。

  • 我已经安装了myst 解析器
  • 通过添加extensions = ["myst_parser",]修改conf.py

编写一个.md文件,如下所示:

# sample_md
```{doxygenclass:: X::A}
:members:
:protected-members:
:private-members:
```

但是在错误消息为时失败

WARNING: unknown directive or role name: doxygenclass::A
/net/users/Linux_Home/user_name/project_name/doc/md_files/sample_mark.md:5: WARNING: Unknown directive type "doxygenclass::A".

也试过

# sample_md
```{doxygenclass}
A
:members:
:protected-members:
:private-members:
```

也失败了,错误信息

Exception occurred:
  File "/net/users/Linux_Home/user_name/.local/lib/python3.8/site-packages/myst_parser/docutils_renderer.py", line 973, in run_directive
    if issubclass(directive_class, Include):
TypeError: issubclass() arg 1 must be a class
The full traceback has been saved in /tmp/sphinx-err-guubfd6h.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!
make[2]: *** [doc/CMakeFiles/Sphinx.dir/build.make:63: doc/sphinx/index.html] Error 2
make[1]: *** [CMakeFiles/Makefile2:215: doc/CMakeFiles/Sphinx.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

不知道在这个阶段要做什么。

我在.md文件中使用了以下片段

```{cpp:class} X::A
```

它显示了呈现的 class 但只有带有可点击链接的名称,其中没有 Doxygen XML 的文档。 我需要这些信息。

我的一些观察是:

  • myST仅用于收集 markdown 文件中的Sphinx directive
  • 呼吸是一个获取Doxygen XML output并使用SphinxreST样式编写的工具

现在我想知道,是否可以在.md文件中添加breathe Doxygen directive 如果是,我在哪里使语法错误?

你能试试这个吗?

```{doxygenclass} X::A
:members:
:protected-members:
:private-members:
```

如果失败,报告错误?

这里得到了答案。

现在 markdown 文件如下

```{eval-rst}
.. doxygenclass:: X::A

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM