I would like to share with you something fun. The right way to write interactive documentation - Try .NET. It is an awesome project maintained by Microsoft. It allows you to embed C# code inside your markdown documentation and run it locally. The absolute best way to learn it is to use it. So I encourage you to fork https://github.com/NikiforovAll/intro-to-algorithms and play with it.
All you need to do is to navigate to root directory and run:
dotnet tool install -g dotnet-try dotnet try
On the demo below you can find implementation of standard sorting algorithms with C# 8 and
Non-interactive version: https://github.com/NikiforovAll/intro-to-algorithms/blob/master/docs/Sorting.md