V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
AndyAO
V2EX  ›  问与答

Python 问题求助:如何让 Sphinx 识别出“参数”和“返回值”这类文档重要元素?

  •  1
     
  •   AndyAO · Sep 16, 2021 · 674 views
    This topic created in 1684 days ago, the information mentioned may be changed or developed.

    我想使用 Sphinx 来生成 html 文档,虽然可以成功生成,但识别不了像:param content:这样的元素,这些内容都被识别为文本,可读性极差。

    在这里可以看到具体的代码文件,使用.\make.bat html可以生成文档: Shared/sphinx-document-generation at master · Andy-AO/Shared

    为什么会出现这种情况?如何才能让文档生成器识别这些元素?

    查看过autodoc扩展的文档之后,还是没有能够找到相关的设置,可能是我忽略了某些重要的内容。

    有人遇到过这种情况吗?可能的原因是什么?

    Supplement 1  ·  Sep 16, 2021

    问题已经解决,是 reStructuredText 的格式有问题

    1. Description和元素之间要有空行

      ×

      		"""
      		describe
      			:param child_node: this is child_node
      

      		"""
      		describe
      
      		:param child_node: this is child_node
      
    2. 元素和元素的内容之间要有空格

      • × - :param content:需要添加的对象
      • √ - :param content: 需要添加的对象
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1137 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 23:07 · PVG 07:07 · LAX 16:07 · JFK 19:07
    ♥ Do have faith in what you're doing.