Google Code Prettify 的使用方式就是這麼簡單,會自動判斷要上色的關鍵字,支援多種語言如 C 語言家族、Java、Python、Bash、SQL、HTML、XML、CSS、Javascript、Makefiles 等,對於 Perl、Ruby、PHP、VB、Awk 也部份支援。底下是一些其他範例:
這是 Google Maps API 的第一個範例:
<pre class="prettyprint">
<!DOCTYPE html "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Maps JavaScript API Example</title>
<script src="http://maps.google.com/maps?file=api&v=2&key=abcdefg&sensor=true_or_false"
type="text/javascript"></script>
<script type="text/javascript">
function initialize() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(37.4419, -122.1419), 13);
}
}