I will also add to others suguested https://nbdev.fast.ai/ which is a state of the art "literate programming environment, as envisioned by Donald Knuth back in 1983!".
It also has some git hooks that help a little https://nbdev.fast.ai/#Avoiding-and-handling-git-conflicts and the other commands like:
- nbdev_read_nbs
- nbdev_clean_nbs
- nbdev_diff_nbs
- nbdev_test_nbs
So you can also create your documentation on the go as while writing a library for example some of them:
You can see a video here nbdev tutorial apart from the first link.