Python sphinx 在Sphinx文档中隐藏单个部分
我找不到处理此问题的指令 假设有一个单独的Python sphinx 在Sphinx文档中隐藏单个部分,python-sphinx,restructuredtext,sections,Python Sphinx,Restructuredtext,Sections,我找不到处理此问题的指令 假设有一个单独的rst文档,出于某种原因,您希望在构建过程中隐藏一个单独的部分(无论是HTML还是PDF…),例如: 是否有。。隐藏::指令来处理这个问题,我想到的是: Visible section ================ Here some example I want to show .. hidden:: Not visible section =================== Some text that I have written bu
rst
文档,出于某种原因,您希望在构建过程中隐藏一个单独的部分
(无论是HTML还是PDF…),例如:
是否有。。隐藏::
指令来处理这个问题,我想到的是:
Visible section
================
Here some example I want to show
.. hidden::
Not visible section
===================
Some text that I have written but for the current build I want to hide from the final document
.. visible::
Another section
===============
Other visible section in both text and final document
您可以使用注释语法: 我得到的Sphinx版本会自动生成一个index.rst文件,该文件以如下注释开头:
.. sphinx-quickstart on Sat Jun 22 15:48:19 2019.
You can adapt this file completely to your liking, etc
文档中没有显示它。你可以用两个点和一个空格开始行,后面跟着你自己的文本,但也不会显示出来。您需要确保创建的所有行的缩进与第一行相同。那么整个部分就不会出现了。还要确保节前后都有空行(除非它是文件中的第一节或最后一节)这里有一个隐藏节的解决方案,这样它就不会显示在HTML输出中。 但是,这并不影响构建 其思想是使用diretive,这样就可以将CSS类分配给节。在CSS中,您可以使用
display:none
(或任何其他CSS)定义类
例如,它看起来像(注意标识):
在css中添加以下样式:
.hidden { display: none }
下面是一个例子,解释了如何将自定义CSS添加到Sphinx中。这里没有回答您的问题吗?:部分感谢。我在这里发现了一些有用的东西:如果你用两个点开始一行,然后是一个空格,它就不会出现在文档中。事实上,Sphinx会自动创建一个类似这样的节,但它不会显示:您所描述的是注释语法:
Visible section
================
Here some example I want to show
.. class:: hidden
Not visible section
===================
Some text that I have written but for the current build I want to hide from the final document
Another section
===============
Other visible section in both text and final document
.hidden { display: none }