bootstrap google-code-prettifier

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewpot" content="width=device-width,initial-scale=1.0">

    <title>learn bootstrap</title>

    <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
	<link href="google-code-prettify/prettify.css" rel="stylesheet">
  </head>
  <body onload="prettyPrint()">
  <script src="jquery1.11.3/jquery-1.11.3.min.js"></script>
  <script src="bootstrap/js/bootstrap.js"></script>
  <script src="google-code-prettify/prettify.js"></script>

  <div class="container">
	<code>
		System.out.println("dongshenjiushi");
	</code>
	<pre class="prettyprint linenums">
local scheduler = require(cc.PACKAGE_NAME .. ".scheduler")
 
local MainScene = class("MainScene", function()
    return display.newScene("MainScene")
end)

function MainScene:ctor()

    local label=cc.ui.UILabel.new({
        UILabelType = 2, text = "test hero move control", size = 32})
        :align(display.CENTER, display.cx, display.cy+150)
        :addTo(self)


    local handle  
    local interval = 1  
    local repeatIndex = 3  
    local index = 0  
    handle = scheduler.scheduleUpdateGlobal(function()  
        index = index + 1  
        label:setString(string.format("%d", index))  
        if index >= repeatIndex then  
            scheduler.unscheduleGlobal(handle)  
            print("over")  
        end  
    end)  
end

return MainScene
	</pre>
  </div>
  </body>
</html>

步骤

  1. 首先导入prettifier的css样式
  2. 导入prettifier的js
  3. 在pre标签当中写入class="prettyprint"
  4. body上写一个onload函数onload="prettyPrint()"
原文地址:https://www.cnblogs.com/yufenghou/p/4502770.html