gpt4 book ai didi

python-sphinx - 在 Sphinx RTD 站点上每个页面的顶部添加警告指令

转载 作者:行者123 更新时间:2023-12-03 08:45:06 25 4
gpt4 key购买 nike

我想在 Sphinx RTD 网站上每个页面的顶部添加一个简单的警告指令:

.. attention::

The next major release of this project will launch on X date.
In the meantime, we're looking for feedback.
If you'd like an early preview, please reach out at <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="02716d6f67676f636b6e42716d6f67636666706771712c616d6f" rel="noreferrer noopener nofollow">[email protected]</a>!

最简单的方法是什么?我正在使用sphinx_rtd_theme

我可以了解如何使用 extrabody block 添加 block ,但它出现在主要内容区域之外,并且完全独立地定位和设置样式。

理想情况下,我希望此 block 显示在每个页面面包屑下方的注意指令中。

最佳答案

您可以将其添加到 conf.py Sphinx 配置文件中:

rst_prolog = """.. attention::
The next major release is imminent.
"""

它将包含在读取的每个源文件的开头 - 请参阅 https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-rst_prolog .

F 字符串文字也可以工作,因此 f'This is release #{release}' 将替换该变量值。

关于python-sphinx - 在 Sphinx RTD 站点上每个页面的顶部添加警告指令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61798722/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com