Quantalabs
Quantalabs

Reputation: 449

ReadTheDocs: Publishing Pre-Built HTML Pages to ReadTheDocs

I was trying to create documentation from python doc strings, and found pdoc. If you don't know, it creates html documentation from python doc strings. Since it generates .html files and not .rst, how do I publish those to ReadTheDocs or generate .rst files using pdoc?

Quick sidenote: I don't want to use sphinx since 1) the theme pdoc has is pretty cool and 2) I don't know how to generate documentation from docstrings using sphinx (all the tutorials I looked at didn't help).

Upvotes: 1

Views: 999

Answers (2)

Joy
Joy

Reputation: 21

Manuel's answer is right and helpful, though the operation to override the build process is a beta feature.

I built my html docs using local tools and moved html files into a folder, e.g., pre_built_html/.

And the .readthedocs.yaml file is like:

version: 2

build:
    os: ubuntu-20.04
    tools:
      python: "3.8"
    commands: 
      - mkdir --parents _readthedocs/html/
      - cp --recursive pre_built_html/* _readthedocs/html/

By the way, i also removed the original docs folder.

Upvotes: 2

Manuel Kaufmann
Manuel Kaufmann

Reputation: 480

Read the Docs released a beta feature some time ago that allows you to completely override the build process. This means that you can execute custom commands (e.g. pdoc) and output all the HTML to a particular directory (_readthedocs/html). Once the build is finished, Read the Docs will publish the content of that directory.

Check out the documentation at https://docs.readthedocs.io/en/stable/build-customization.html#override-the-build-process

Upvotes: 2

Related Questions