cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Community Advocate
Community Advocate

Pasting Code Into A Page

Jump to solution

Several of our teachers teach coding classes and would love to be able to paste example code into a page and have it look formatted, indented, and color coded. Essentially they want to be able to do what we can do on this Canvas forum like this:

<HTML>

<HEAD>

<TITLE> Hello World in Javascript </TITLE>

</HEAD>

<BODY>

<h2>Example 1</h2>

<script language="Javascript">

// Hello in Javascript

// display prompt box that ask for name and

// store result in a variable called who

var who = window.prompt("What is your name");

// display prompt box that ask for favorite color and

// store result in a variable called favcolor

var favcolor = window.prompt("What is your favorite color");

// write "Hello" followed by person' name to browser window

document.write("Hello " + who);

// Change background color to their favorite color

document.bgColor = favcolor;

</script>

</BODY>

</HTML>

Does anyone know of a way to do this in the RCE or maybe a place they can type code that will generate an embed that they can use on the page?

20 Replies
Highlighted
Community Member

Another vote up!

Highlighted

Thanks for the clarification, Hanes.Matthew.B@muscogee.k12.ga.us​.

Yes, several of us are looking for a built-in code formatter!

Highlighted

Yes, I must not be very good at explaining what I'm looking for. chofer@morainepark.edu​'s idea is exactly what I'm looking to be able to do for our coding teachers so they can paste example code onto a page that is marked up and formatted instead of just plain text.

Highlighted
Community Coach
Community Coach

Hanes.Matthew.B@muscogee.k12.ga.us

Have I misread your question? If so, ignore my answer.

When your use the "Edit" feature in any Canvas area that includes an RCE (Pages, Syllabus Description, Discussion, Assignment instructions, and Quiz questions) there is always an HTML Editor in the background. By switching to the HTML Editor, you can paste code on a page to accomplish both formatting and content creation including embedding. There are some limitations of the tags permitted, and executable Java scripting is stripped out by the background global Canvas code; but you can still accomplish some fairly amazing things.

Check out: What is the Rich Content Editor?

Also, we have a Canvas Hacks Demo Course that we can enroll you in with many tips, tricks and techniques for using code in Canvas. Shoot me an email if you want to be enrolled in this.

I hope this helps.

Highlighted

Love this - I just voted for it too!

Highlighted

Me too!

Highlighted
Community Advocate
Community Advocate

Which I already voted for! I wish I could vote for it a million times.

Highlighted
Community Coach
Community Coach

Kind of like my Feature Idea here: 

View solution in original post

Highlighted
Community Advocate
Community Advocate

I'm looking for something they could actually embed into their Canvas page.

Highlighted
Community Member

Hi Matt,

Would W3Schools Try it Yourself be a possibility: W3Schools Online Web Tutorials using this Whitelist as a reference?

https://s3.amazonaws.com/tr-learncanvas/docs/Canvas_HTML_Whitelist.pdf

Joe