Help Center / Course Admin

How to add sample code to a lesson

Video: How to add sample code to a lesson.

If your course is related to software or web development you can display sample code that stands out in a nicely formatted way.

Navigate to the desired lesson and click the + Insert Content button.

Choose the Code Sample option from the dropdown menu.

Code Sample option on the Insert Content menu.
Code Sample option on the Insert Content menu.

When the add code widget appears enter your code in the form.

Choose the appropriate language from the dropdown menu for syntax highlighting.

Example: Add JavaScript sample code.
Example: Add JavaScript sample code.

You can also choose from different themes to change the appearance of your sample code.

Sample Code: Choose from different themes.
Sample Code: Choose from different themes.

After making your language and theme selections click the Add Code Sample button.

The screenshot below shows a preview of some JavaScript sample code added to a lesson with two different theme choices.

Example of sample code added to a lesson.
Example of sample code added to a lesson.

Now your students will be able to view and copy/paste the sample code when viewing the lesson.

After adding sample code to a lesson your students will be able to see it as well as highlight it for copy/pasting.