Although Canvas at WSE does not support native code highlighting tools or plugins, you can still display formatted code by using an external code-to-HTML converter. This allows you to add visually enhanced code blocks in a variety of programming languages directly into your Canvas pages.
How to Add Code to Canvas Using HTML
-
Convert Your Code
Use a code-to-HTML converter to transform your code snippet into HTML. There are many free tools online that support syntax highlighting for various programming languages. -
Open the Canvas Page
Log in to Canvas and navigate to the page where you want to add your formatted code. Click Edit to modify the content. -
Access the HTML Editor
In the rich content editor, click the</>
icon to switch to the HTML editor. -
Paste the HTML
Paste the converted HTML code into the HTML editor. Click Save (or Save & Publish) to update the page.
Once saved, your code block should appear with proper formatting and syntax highlighting, giving it a cleaner and more readable look.