I encourage and venture to follow the following principles:
The code is more important than the documentation, but with time you will forget part of what you coded. So document from the beginning to get a high-level view of what you've done.
The code is more important than the documentation, but having the documentation will help anyone joining the project in the future. This will avoid the bus factor.
Using a specific documentation tool is cool, but if it's too far from the code, you might forget to update the documentation. So, bring the documentation as close to the code as possible.
Agile Manifest Topic 2: "Software at Work More Than Comprehensive Documentation."
Let's look for better ways to integrate code with documentation. Working software is important, but we still need documentation.
Examples of actions that directly or indirectly promote documentation close to the code:
- Plantuml (https://plantuml.com);
- Swagger (https://swagger.io);
- Markdown (https://www.markdownguide.org)