Skip to main content

Adding a code block (Legacy editor)

Add code that keeps its indentation to a block in a Legacy editor lesson.

Written by Kat Morgan

This article covers the Legacy editor. For the New editor, see Adding images, tables and code to a lesson.

A code block keeps your code's spacing and indentation and shows it in a monospace font, which matters for languages like Python.


​

Adding a code block

1. Open the lesson from My Library. The Outline down the left lists the lesson's blocks.

2. Click the block, then click into the text where the code should go.

3. Click Code in the formatting toolbar. If you can't see the toolbar, click Aa at the bottom of the box.

A code block inserted in a Legacy editor content block


​

4. Type or paste your code into the code box.

5. Click Save.


​

Did this answer your question?