You can add a block of code to run in page-like courses. Code snippets will allow you to illustrate learning content with examples of computing code while maintaining its language-specific formatting.


How to insert a block of code

  1. Open a page.

  2. Click on "+" and select Code snippet at the bottom of the drop-down list. 



  3. Then, select a language.


    When inserting a code block for the first time, the default language is JavaScript. The rest of the blocks of code will have the language that was most recently selected.

  4. Paste the fragment of code into the block.



    Well done! You’
    ve successfully added a code snippet.

How to edit code within a block

You can continue to format the code by changing the syntax highlighting, background color, tabbing, and font size as desired.

  1. Select the block of code.

  2. Click on More settings.



  3. Then, select the background color from the suggested options or the pallet.



  4. If you need to increase or decrease the space around the block, select the size from the drop-down list.



  5.  You can also apply different syntax highlighting by choosing another programming language from the drop-down menu.



  6. To increase and decrease the font size within the block, select the preferred size from the list.


How to insert code into a sentence

Another way to add a code fragment is by using a new style named Code. This is available on the text styles tab.

  1. Highlight the part of a sentence that contains a programming code.



  2. Click on Font Style.



  3. Select Code (<>).



    Well done! You’ve converted part of the sentence into code.