I'm having issues getting the Google Code Prettify to work properly. This example is working, using the provided remote files:
<html>
<head>
<title>Google Code Prettify testing</title>
<script data-brackets-id='140' src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js?autoload=true&skin=sunburst&lang=css" defer="defer">
</script>
</head>
<body>
<h1>Google Code Prettify testing</h1>
<pre class="prettyprint" style="font-size: 12pt;">
<script type="text/javascript">
// This is a comment
var myString = "Hello, World!";
var myInt = 42;
function helloWorld(world) {
for (var myInt; --myInt >= 0;) {
alert(myString);
}
}
</script>
<style>
p { color: pink }
b { color: blue }
u { color: "umber" }
</style>
</pre>
</body>
</html>
Result:
This is pulling from the Prettify remote hosting. Please note that some items in <script>
are only for styling and behavior. The following works fine as well:
<html>
<head>
<title>Prettify Default Test</title>
<script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script>
</head>
It just renders with the default look and behavior (note this is a different browser)
However, when I downloaded and saved files locally, I write this:
<html>
<head>
<title>Google Code Prettify testing</title>
<link href="google-code-prettify/src/prettify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="google-code-prettify/js-modules/run_prettify.js"></script>
</head>
<body onload="prettyPrint()">
<h1>Google Code Prettify testing</h1>
<pre class="prettyprint" style="font-size: 12pt;">
<script type="text/javascript">
// This is a comment
var myString = "Hello, World!";
var myInt = 42;
function helloWorld(world) {
for (var myInt; --i >= 0;) {
alert('Hello ' + String(world));
}
}
</script>
<style>
p { color: pink }
b { color: blue }
u { color: "umber" }
</style>
</pre>
</body>
</html>
And, follows, none of the formatting carries over:
Here is a snapshot of the folder structure. I have verified to be sure it was accurately referenced in the code...
prettify.css
run_prettify.js
Can you offer any advice as to why it's acting this way?
autoload=true&skin=sunburst&lang=css
. Does your code have a way of providing these parameters? Provide code for css and javascript – Evansville