如何编辑斯芬克斯雪花石膏下的边栏

2024-05-16 07:48:55 发布

您现在位置:Python中文网/ 问答频道 /正文

我有以下index.rst文件。在

Know the cell population of your data
=====================================
Some content

.. toctree::
   :maxdepth: 2

Installation
~~~~~~~~~~~~
.. toctree::
   :maxdepth: 2

   installation

Scripts
~~~~~~~
.. toctree::
   :maxdepth: 2

   scripts

API documentation
~~~~~~~~~~~~~~~~~
.. toctree::
   :maxdepth: 2

   apidoc

Roadmap
~~~~~~~
.. toctree::
   :maxdepth: 2

   roadmap

Indices and Tables
==================
* :ref: `genindex`

现在侧边栏如下所示:

enter image description here

如图所示。我想做几件事。在

  1. 只删除侧边栏中的标题,但保留在主页面中。在
  2. 添加新的URL链接,但不显示在主页面,如“索引和表”

我怎么能做到呢?在


Tags: 文件oftheyourdataindexcellsome
2条回答

我最后用下面的方法解决了这个问题

在Sphinx的模板目录中创建一个文件 称为foo.html。在

内容可能如下所示:

<hr />
<p>
<h2 class='logo'>
<a href="https://foo.bar.com/">Web Version</a>
</h2>
</p>

终于在配置文件添加:

^{pr2}$

最后看起来是这样的:

enter image description here

我可以为第一个问题提些建议。我绝不是CSS方面的专家,所以我的解决方案可能不是更优雅的,但它很管用!把你的源/静态/自定义.css'文件:

.sphinxsidebar a.reference.internal[href='#'] {
  display: none;
}

也许CSS专家应该给一个更好的选择

相关问题 更多 >