Code block is the key element of any documentation. Developers often read and use code without looking at explanations around. So make sure code block itself provides enough information to be understood and correctly reused.
Online playground allows to edit and execute code right from the browser. It makes documentation interactive and builds an engaging onboarding experience. While it won't work for many projects, be sure to explore your options - you may be surprised!
Reproducing examples from documentation can be a tedious process. Let the reader see the result of code execution without leaving the docs.