Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to provide Code highlighting on sites.google.com websites?

Is it possible to do Code Syntax highlighting on sites.google.com websites like the way we do it on Blogger.com or Wordpress.com?

like image 221
user855 Avatar asked Dec 07 '09 05:12

user855


People also ask

Can you highlight text in Google Sites?

You can change how your text looks, add numbered or bulleted lists, or insert links in new Google Sites. On a computer, open a site in new Google Sites. At the top right, click Pages, then choose the page you want to edit. Highlight the text, or click where you want to insert a list or link.

Can you add HTML code to Google Sites?

Add HTML, CSS, or JavaScript code to your siteOn a computer, open a site in new Google Sites. Embed. You can also add an embed as an entire page.

How do you edit the HTML code on Google Sites?

Use the Insert menu, then HTML Box. Once the Insert HTML Box editor appears add the code you want to use. Google Sites checks the code, while you edit, for errors and will not add the code to the page until correct. Once finished use the Save button on the Insert HTML Box.

Does Google Sites need coding?

Although you do NOT need to code to build a Google site, it covers the design principles you need to consider to enable users to fully engage with your work.


2 Answers

Unfortunately there is until now no support for syntax highlighting within Google Sites. As a workaround you could use http://tohtml.com/ and enter your code there and copy the colored output (not the HTML) directly into your Google Sites page.

This works perfectly, as long as you don't need to edit large pieces of the code regularly.

like image 148
znq Avatar answered Oct 12 '22 13:10

znq


I have tried creating a gadget myself with Google Code Prettify, and there were a few issues.

One is that classes aren't supported, so you will have to follow what Stack Overflow is doing to prettify. http://www.codingthewheel.com/archives/syntax-highlighting-stackoverflow-google-prettify

The other problem I faced was the interaction between the iframe and the parent frame. You will notice that there is a domain permission problem, and so you will be unable to access the parent.document from your iframe.

This should save some people a few hours of hacky testing.

like image 27
lcampanis Avatar answered Oct 12 '22 14:10

lcampanis