2013/09/09
安装 google-code-prettify 并将程序(源代码)发布到您的博客上
你好,这是 naouniverse ( @naouniverse708 )。
前几天的文章,
我尝试将程序(源代码)发布在我的博客上,但它似乎在我的智能手机上显示不佳,所以我决定这次尝试google-code-prettify
<head>我在标签内插入了以下内容。
<link rel="stylesheet" href="https://google-code-prettify.googlecode.com/svn/trunk/src/prettify.css" type="text/css" media="screen" /> <script type="text/javascript" src="https://google-code-prettify.googlecode.com/svn/trunk/src/prettify.js"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ prettyPrint(); }); </script> <style type="text/css"> pre.prettyprint { background-color: rgb(248, 248, 248); color: gray; padding: 0 0 0 3px; } ol.linenums li { list-style: decimal outside; line-height: 1.5; border-left: solid 3px #6CE26C; padding-left: 3px; margin-left: .7em; background-color: rgb(248, 248, 248); } </style>
所以,把代码放到文章里,
<pre class="prettyprint linenums">#import "ViewController.h" @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; } @end</pre>
如果你像这样输入,
#import "ViewController.h" @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; } @end
它将像这样显示。
智能手机的显示效果还有改进的空间,但我个人认为与之前的快速荧光笔相比,它已经很到位了。