Skip to content

Instantly share code, notes, and snippets.

@jakecyr
Created March 23, 2023 04:18
Show Gist options
  • Select an option

  • Save jakecyr/93f184abd16c5de3558798c47db0b5c8 to your computer and use it in GitHub Desktop.

Select an option

Save jakecyr/93f184abd16c5de3558798c47db0b5c8 to your computer and use it in GitHub Desktop.
Python Semantic Release with Sphinx (GPT-4 Generated)

To include the CHANGELOG.md file in your Sphinx documentation, you can use the m2r2 extension to convert the Markdown file to reStructuredText format, which Sphinx can process.

First, install the m2r2 package by adding it to your pyproject.toml file:

[build-system]
requires = [
    # ... other dependencies ...
    "m2r2"
]

Next, update your docs/conf.py file to include the m2r2 extension:

extensions = [
    # ... other extensions ...
    'm2r2',
]

Create a new file named changelog.rst in your docs/source directory with the following content:

Changelog
=========

.. mdinclude:: ../../CHANGELOG.md

This file will include the content of the CHANGELOG.md file in your Sphinx documentation.

Finally, add a reference to the changelog.rst file in your docs/source/index.rst file:

.. toctree::
   :maxdepth: 2
   :caption: Contents:

   # ... other files ...
   changelog

Now, the CHANGELOG.md file will be included in your Sphinx documentation. The updated .gitlab-ci.yml file remains the same as in the previous response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment