Trying to add formatted and colorized programming language code to pages in Canvas. Anyone know of a good way to do that? Everything I find online uses both js and CSS to do that. Is there an LTI for such a thing? I heard from Canvas support that Github LTI is no more.
Pasting Code Into A Page - LTIs in here no worky no more
I just found this:
Maybe not the prettiest thing, but it seemed to work for using a Python file as an example and showed up fine in the Canvas page.
Edit: You may need to stick to the light themes on this tool. My Canvas instance at least applies an #f5f5f5 background color to all <pre> tags, unless you have the ability to override this in your instance's CSS.
And there's also this one: https://tohtml.com Doesn't seem to have the pre background issue that the other one does.
I'd love to see an LTI for this too.
Is this something you will control or students will use? What languages are you trying to support?
I posted an idea in the Canvashacks Classroom as a quick work around, but it didn't pick up any momentum. I understand why. :smileygrin:
One solution might be embedding external services and widgets in HTML files uploaded to Canvas. I'm tagging laurakgibbs because she has some experience in this and I haven't tried.
I think there have been a few feature requests, but they didn't get any momentum either.
Caution. Tangent ahead...
Most Rich Text Editors for the web are pretty friendly to preformatted code. Take for example Visual Studio Code, which is built on top of Electron, which is basically a browser. When you copy code from the IDE, and paste it somewhere like Jive or Gmail, it keeps most of the formatting (Jive got rid of indents), Gmail does not.
This won't work in Canvas.
This snippet was just sent to me via Gmail.
There is an LTI called 'code embed' that appears directly in the RCE. If you do a Google search for it it will turn up. It used to be in the eduapp Center but is no longer so not sure how well maintained it is. Regardless I believe the source is available on github
Canvas even supports ligatures and diagraphs such as those found on the page: