File: demo.html

package info (click to toggle)
prettify.js 2015.12.04%2Bdfsg-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 796 kB
  • sloc: perl: 113; makefile: 107; sh: 54
file content (61 lines) | stat: -rw-r--r-- 1,734 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html><head>
<script src="../src/prettify.js"></script>
<script src="../src/lang-css.js"></script>
<style>
body { margin: 0; padding: 0 }
pre { margin: 0 }
</style>
</head>
<script>
// This page displays some code styled using a theme named in the
// query part of the URL.
var themeName = decodeURIComponent(document.location.search.replace(/^\?/, ''));

// Call out to the parent so that it can resize the iframe once this
// document's body is loaded.
function adjustHeightInParent() {
  if (parent !== window) {
    try {
      var div = document.body.getElementsByTagName('div')[0];
      parent.adjustChildIframeSize(
          themeName, div.offsetWidth, div.offsetHeight);
    } catch (ex) {
      // Can happen when this page is opened in its own tab.
    }
  }
}

// Load the necessary CSS
(function () {
  document.title = 'Theme ' + themeName;
  // Load the stylesheet that we're demoing.
  var link = document.createElement('link');
  link.rel = 'stylesheet';
  link.type = 'text/css';
  link.href = themeName === 'default'
      ? '../src/prettify.css' : themeName + '.css';
  document.getElementsByTagName('head')[0].appendChild(link);
})();
</script>

<body onload="prettyPrint(); adjustHeightInParent()">
<div style="width: 40em; display: inline-block">
<pre class="prettyprint lang-html linenums">
&lt;script type="text/javascript"&gt;
// Say hello world until the user starts questioning
// the meaningfulness of their existence.
function helloWorld(world) {
  for (var i = 42; --i &gt;= 0;) {
    alert('Hello ' + String(world));
  }
}
&lt;/script&gt;
&lt;style&gt;
p { color: pink }
b { color: blue }
u { color: "umber" }
&lt;/style&gt;
</pre>
</div>
</body></html>