ReadTheDocs Sphinx PDF 文件中的标题和章节混乱

发布于 2025-01-10 04:51:41 字数 3341 浏览 0 评论 0原文

由于某种原因,字幕成为 ReadTheDocs 为我的文档生成的 PDF 中的章节。

在这里查看:https://yarsaw.namantech.me/_/ downloads/en/latest/pdf/

这是索引文件的代码,

######################
**Welcome to YARSAW!**
######################

YARSAW is an open source, free and easy to use API Wrapper for the `Random Stuff API`_.


***************
Overview
***************

Features:

* Wraps all of the `Random Stuff API <https://api-info.pgamerx.com>`_
* Async-ready
* Easy to use
* Saves you a lot of time

*****************
Installation
*****************

To install the latest stable version of YARSAW, run the following command:

.. code-block:: bash

      python -m pip install yarsaw

To install a specific version of YARSAW, run the following command:

.. code-block:: bash

      python -m pip install yarsaw==<version>

To install the beta version of YARSAW, run the following command:

.. code-block:: bash

      python -m pip install git+https://github.com/BruceCodesGithub/yarsaw --upgrade



****************
Getting Started
****************

Get your API Keys
==================

1. Register to get an API Key at the `Random Stuff API resgistration page <https://api-docs.pgamerx.com/Getting%20Started/register/>`_. This is used for authentication.

2. Register at `RapidAPI <https://rapidapi.com/pgamerxdev/api/random-stuff-api>`_ for a RapidAPI Key and Account, and subscribe to the Random Stuff API. This is used to make requests to the Random Stuff API and keep track of them. You can go to `The RapidAPI Developer Dashboard <https://rapidapi.com/developer/apps>`_ after logging in, select an application, head over to security, and copy its key. This is your RapidAPI Key.

Examples
========

.. code-block:: python

      import yarsaw
      import asyncio # builtin, used for asynchronous calls

      client = yarsaw.Client("your_api_key", "your_rapidapi_key")

      async def joke():
         joke = await client.get_joke() # get the joke in form of a dict
         formatted_joke = yarsaw.Utils().format_joke(joke) # format the joke (optional)
         print(formatted_joke) # print the joke

      asyncio.get_event_loop().run_until_complete(joke()) # run the joke() function

Now just start reading the documentation!

****************
Contents
****************

.. tip::
   The :doc:`client` page contains all of the methods you can use to interact with the Random Stuff API, so we recommend reading that first.

.. toctree::
   :maxdepth: 1
   :caption: Documentation

   client
   utils
   
.. toctree::
   :maxdepth: 1
   :caption: Other Pages and Resources

   faq
   changelog

Documentation Last Updated on |today|

我希望“Welcome to YARSAW”成为第一章,下一个文件成为下一个。相反,字幕成为章节,所有其他内容成为副标题。

我遵循 https://readthedocs.org/ 的约定语法项目/documentation-style-guide-sphinx/downloads/pdf/latest/

它在文档页面本身上运行良好(https://yarsaw.namantech.me)。

更改航向标志不起作用。

完整代码: https://github.com/BruceCodesGithub/yarsaw

For some reason, the subtitles become the chapters in the PDF generated for my docs by ReadTheDocs.

Check it out here: https://yarsaw.namantech.me/_/downloads/en/latest/pdf/

Here's the code for the index file

######################
**Welcome to YARSAW!**
######################

YARSAW is an open source, free and easy to use API Wrapper for the `Random Stuff API`_.


***************
Overview
***************

Features:

* Wraps all of the `Random Stuff API <https://api-info.pgamerx.com>`_
* Async-ready
* Easy to use
* Saves you a lot of time

*****************
Installation
*****************

To install the latest stable version of YARSAW, run the following command:

.. code-block:: bash

      python -m pip install yarsaw

To install a specific version of YARSAW, run the following command:

.. code-block:: bash

      python -m pip install yarsaw==<version>

To install the beta version of YARSAW, run the following command:

.. code-block:: bash

      python -m pip install git+https://github.com/BruceCodesGithub/yarsaw --upgrade



****************
Getting Started
****************

Get your API Keys
==================

1. Register to get an API Key at the `Random Stuff API resgistration page <https://api-docs.pgamerx.com/Getting%20Started/register/>`_. This is used for authentication.

2. Register at `RapidAPI <https://rapidapi.com/pgamerxdev/api/random-stuff-api>`_ for a RapidAPI Key and Account, and subscribe to the Random Stuff API. This is used to make requests to the Random Stuff API and keep track of them. You can go to `The RapidAPI Developer Dashboard <https://rapidapi.com/developer/apps>`_ after logging in, select an application, head over to security, and copy its key. This is your RapidAPI Key.

Examples
========

.. code-block:: python

      import yarsaw
      import asyncio # builtin, used for asynchronous calls

      client = yarsaw.Client("your_api_key", "your_rapidapi_key")

      async def joke():
         joke = await client.get_joke() # get the joke in form of a dict
         formatted_joke = yarsaw.Utils().format_joke(joke) # format the joke (optional)
         print(formatted_joke) # print the joke

      asyncio.get_event_loop().run_until_complete(joke()) # run the joke() function

Now just start reading the documentation!

****************
Contents
****************

.. tip::
   The :doc:`client` page contains all of the methods you can use to interact with the Random Stuff API, so we recommend reading that first.

.. toctree::
   :maxdepth: 1
   :caption: Documentation

   client
   utils
   
.. toctree::
   :maxdepth: 1
   :caption: Other Pages and Resources

   faq
   changelog

Documentation Last Updated on |today|

I want Welcome to YARSAW to be the first chapter, the next file to be the next. Instead, the subtitles become the chapters, and all the other content becomes subtitle.

I followed convention syntax from https://readthedocs.org/projects/documentation-style-guide-sphinx/downloads/pdf/latest/.

It works fine on the docs page itself (https://yarsaw.namantech.me).

Changing heading signs does not work.

Full code: https://github.com/BruceCodesGithub/yarsaw

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

盛夏已如深秋| 2025-01-17 04:51:41

[已解决]
问题在于目录树位于标头下方,这导致了问题。移至文件顶部即可解决该问题。

[SOLVED]
The problem was that the toctree was below headers, which caused issues. Moving to the top of the file solves it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文