This article covers the Legacy editor. Lessons built in the New editor work differently. To add a code block in the New editor, see Adding images, tables and code to a lesson. New to the difference between the two? Start with The new lesson experience.
Adding a code block
Open the lesson from My Library. The Legacy editor shows the lesson as a list of blocks, with the Outline down the left.
Click into the block, then use the code button (<>) in the formatting toolbar. Code keeps its indentation and uses a monospace font.
Click Save when you are done.

