I wanted to format a code block and inline code onto a Canvas page. See the examples below.
Is there an easy way to do this?
Dawn, greetings! Due to the technical nature of this question, I'm going to share this with the Canvas Developers group in the community. Hopefully, they'll be able to help!
With canvas, you can go to edit the HTML of a page. From there you can use <code> and <pre> tags to create coding snippets. For an inline just use <code>Some Code</code> or block use <pre><code>line of code</code></pre>. This won't give you the styling but it will get the idea of code across.
There are also websites which will generate code blocks with styling.
To build off what Peter said ...
You can invoke the preformatted and code elements without going to HTML mode.
Preformatted is available from the same drop select field as paragraph and the headings.
For the code element, press Alt+F9 within the Rich Content Editor to display the menu. Then go to Format and choose code.
When you take the code that from the website Peter mentioned, be aware that much of it will be stripped out since it's unsupported by the Canvas HTML Whitelist. Enough of it works to mimic the syntax highlighting. But this approach is usable even if you can't get the Canvas Admin to add a syntax highlighter to Canvas.
James - Any advice or experience having students paste programming code into a Canvas quiz text box while using Respondus lock down browser (which strips the formatting)? Is there a way to add a basic text editor to the RCE? Thanks!
I don't use lockdown browser or have students submit code through Canvas, so I don't have any experience with this specifically.
The preformatted tag would be the obvious suggestion, but if you change the style to preformatted, then when you paste, it strips all the spacing. What I've done with some success is to turn on the preformatted from the style dropdown, then switch to the HTML editor and paste the code inside the pre element. Then it retains the spacing.
I still do not know if this will work with lockdown browser or not.
Thanks for the suggestion. I'll give it a try!
Retrieving data ...