Documentation improvements

This commit is contained in:
Dan 2022-04-24 11:56:07 +02:00
parent d14665ad96
commit 8af17c3ed5
7 changed files with 16 additions and 25 deletions

View File

@ -53,7 +53,7 @@ If you'd like to support Pyrogram, you can consider:
- **Ready**: Install Pyrogram with pip and start building your applications right away. - **Ready**: Install Pyrogram with pip and start building your applications right away.
- **Easy**: Makes the Telegram API simple and intuitive, while still allowing advanced usages. - **Easy**: Makes the Telegram API simple and intuitive, while still allowing advanced usages.
- **Elegant**: Low-level details are abstracted and re-presented in a more convenient way. - **Elegant**: Low-level details are abstracted and re-presented in a more convenient way.
- **Fast**: Boosted up by [TgCrypto](https://github.com/pyrogram/tgcrypto), a high-performance crypto library written in pure C. - **Fast**: Boosted up by [TgCrypto](https://github.com/pyrogram/tgcrypto), a high-performance cryptography library written in C.
- **Type-hinted**: Types and methods are all type-hinted, enabling excellent editor support. - **Type-hinted**: Types and methods are all type-hinted, enabling excellent editor support.
- **Async**: Fully asynchronous (also usable synchronously if wanted, for convenience). - **Async**: Fully asynchronous (also usable synchronously if wanted, for convenience).
- **Powerful**: Full access to Telegram's API to execute any official client action and more. - **Powerful**: Full access to Telegram's API to execute any official client action and more.

View File

@ -21,6 +21,8 @@ import os
import re import re
import shutil import shutil
import pyrogram
HOME = "compiler/docs" HOME = "compiler/docs"
DESTINATION = "docs/source/telegram" DESTINATION = "docs/source/telegram"
PYROGRAM_API_DEST = "docs/source/api" PYROGRAM_API_DEST = "docs/source/api"
@ -112,6 +114,7 @@ def generate(source_path, base):
toctree.format( toctree.format(
title=k.title(), title=k.title(),
title_markup="=" * len(k), title_markup="=" * len(k),
layer=pyrogram.raw.all.layer,
module=module, module=module,
entities="\n ".join(entities) entities="\n ".join(entities)
) )

View File

@ -1,6 +1,8 @@
{title} {title}
{title_markup} {title_markup}
Layer {layer}
.. module:: {module} .. module:: {module}
.. toctree:: .. toctree::

View File

@ -21,5 +21,4 @@ help:
lhtml: # live html lhtml: # live html
sphinx-autobuild --host $(shell ifconfig | grep "inet " | grep -v 127.0.0.1 | cut -d\ -f2) \ sphinx-autobuild --host $(shell ifconfig | grep "inet " | grep -v 127.0.0.1 | cut -d\ -f2) \
--watch ../pyrogram \ --watch ../pyrogram -b html "$(SOURCEDIR)" "$(BUILDDIR)/html" $(SPHINXOPTS)
-b html "$(SOURCEDIR)" "$(BUILDDIR)/html" $(SPHINXOPTS)

View File

@ -49,7 +49,7 @@ master_doc = "index"
source_suffix = ".rst" source_suffix = ".rst"
autodoc_member_order = "bysource" autodoc_member_order = "bysource"
templates_path = ["_resources/templates"] templates_path = ["../resources/templates"]
html_copy_source = False html_copy_source = False
napoleon_use_rtype = False napoleon_use_rtype = False
@ -63,7 +63,7 @@ suppress_warnings = ["image.not_readable"]
html_title = "Pyrogram Documentation" html_title = "Pyrogram Documentation"
html_theme = "sphinx_rtd_theme" html_theme = "sphinx_rtd_theme"
html_static_path = ["_resources/static"] html_static_path = ["../resources/static"]
html_show_sourcelink = True html_show_sourcelink = True
html_show_copyright = False html_show_copyright = False
html_theme_options = { html_theme_options = {
@ -75,11 +75,11 @@ html_theme_options = {
"style_external_links": True "style_external_links": True
} }
html_logo = "_resources/static/img/pyrogram.png" html_logo = "../resources/static/img/pyrogram.png"
html_favicon = "_resources/static/img/favicon.ico" html_favicon = "../resources/static/img/favicon.ico"
latex_engine = "xelatex" latex_engine = "xelatex"
latex_logo = "_resources/static/img/pyrogram.png" latex_logo = "../resources/static/img/pyrogram.png"
latex_elements = { latex_elements = {
"pointsize": "12pt", "pointsize": "12pt",

View File

@ -14,8 +14,8 @@ Welcome to Pyrogram
<b>Telegram MTProto API Framework for Python</b> <b>Telegram MTProto API Framework for Python</b>
<br> <br>
<a href="https://github.com/pyrogram/pyrogram"> <a href="https://pyrogram.org">
Development Website
</a> </a>
<a href="https://docs.pyrogram.org/releases"> <a href="https://docs.pyrogram.org/releases">
@ -54,17 +54,6 @@ If you'd like to support Pyrogram, you can consider:
- `Become a LiberaPay patron <https://liberapay.com/delivrance>`_. - `Become a LiberaPay patron <https://liberapay.com/delivrance>`_.
- `Become an OpenCollective backer <https://opencollective.com/pyrogram>`_. - `Become an OpenCollective backer <https://opencollective.com/pyrogram>`_.
Key Features
------------
- **Ready**: Install Pyrogram with pip and start building your applications right away.
- **Easy**: Makes the Telegram API simple and intuitive, while still allowing advanced usages.
- **Elegant**: Low-level details are abstracted and re-presented in a more convenient way.
- **Fast**: Boosted up by :doc:`TgCrypto <topics/tgcrypto>`, a high-performance crypto library written in pure C.
- **Type-hinted**: Types and methods are all type-hinted, enabling excellent editor support.
- **Async**: Fully asynchronous (also usable synchronously if wanted, for convenience).
- **Powerful**: Full access to Telegram's API to execute any official client action and more.
How the Documentation is Organized How the Documentation is Organized
---------------------------------- ----------------------------------
@ -172,7 +161,7 @@ Meta
.. toctree:: .. toctree::
:hidden: :hidden:
:caption: Telegram API :caption: Telegram Raw API
telegram/functions/index telegram/functions/index
telegram/types/index telegram/types/index

View File

@ -15,9 +15,7 @@ humans and another more compact for machines that is able to recover the origina
For Humans - str(obj) For Humans - str(obj)
--------------------- ---------------------
If you want a nicely formatted, human readable JSON representation of any object in the API -- namely, any object from If you want a nicely formatted, human readable JSON representation of any object in the API you can use ``str(obj)``.
:doc:`Pyrogram types <../api/types/index>`, :doc:`raw functions <../telegram/functions/index>` and
:doc:`raw types <../telegram/types/index>` -- you can use ``str(obj)``.
.. code-block:: python .. code-block:: python