I'm writing my book on Python performance using Quarto (https://quarto.org/) and it's really great technical writing environment out of the box.
But beyond that, it's also extremely customizable.
Each document (an article or chapter) can be a Jupyter notebook, and I have written custom Jupyter magics that e.g. benchmark different functions and generate markdown tables of the results.
So e.g. I'd write:
```{python}
#| echo: false
%%compare_timing --measure=instructions
function1(DATA)
function2(DATA)
```
And it will benchmark both functions and render a Markdown table that shows mean elapsed time and mean CPU instructions.
Rendering the book, including running benchmarks and formatting their results, is completely automated.