{"id":135359,"date":"2011-02-16T08:00:00","date_gmt":"2011-02-16T08:00:00","guid":{"rendered":"https:\/\/www.weixiaoduo.com\/plugins\/2024\/02\/22\/prettify-gc-syntax-highlighter\/"},"modified":"2012-08-29T01:59:00","modified_gmt":"2012-08-29T01:59:00","slug":"prettify-gc-syntax-highlighter","status":"publish","type":"post","link":"https:\/\/www.weixiaoduo.com\/plugins\/prettify-gc-syntax-highlighter\/","title":{"rendered":"Prettify GC Syntax Highlighter"},"content":{"rendered":"<p>This plugin has prettify.js copied directly from google-code source browser. So your code will look exactly like it does on google-code.<br \/>\nCSS is slightly modified to embolden keywords and types.<\/p>\n<h3>License<\/h3>\n<p>See prettify.js for license details (Apache License 2.0). Other files are available under GPLv2.<\/p>\n<h3>Usage<\/h3>\n<p><pre class=\"prettyprint\"><br \/>\n  \/\/ Put your code here.<br \/>\n<\/pre>\n<\/p>\n<p>Or with shortcode:<\/p>\n<p>[code]<br \/>\n  \/\/ Put your code here.<br \/>\n[\/code]<\/p>\n<h3>Making Code HTML Safe<\/h3>\n<p>The plugin automatically makes highlighted code html-safe:<\/p>\n<p><pre class=\"prettyprint\"><br \/>\n  Anything that goes here will be quoted to appear on the page as-is.<br \/>\n  For example: <head><\/head><body><\/body><br \/>\n<\/pre>\n<\/p>\n<p>To avoid quoting your code, add <strong>dontquote<\/strong> as the first class.<\/p>\n<p><pre class=\"dontquote prettyprint\"><br \/>\n  Remember to quote manually.<br \/>\n  For example: &lt;head&gt;&lt;\/head&gt;&lt;body&gt;&lt;\/body&gt;<br \/>\n<\/pre>\n<\/p>\n<h3>Line Numbering<\/h3>\n<p>Line numbdering can be enabled as follows:<\/p>\n<p><pre class=\"prettyprint linenums\"><br \/>\n  \/\/ Put your code here.<br \/>\n<\/pre>\n<\/p>\n<p>If you want to start with a line number 42, you can do the following:<\/p>\n<p><pre class=\"prettyprint linenums:42\"><br \/>\n  \/\/ Put your code here.<br \/>\n<\/pre>\n<\/p>\n<h3>Highlighting Lines<\/h3>\n<p>When line numbering is enabled you can highlight one or several lines of code using the highlight class:<\/p>\n<p><pre class=\"prettyprint lang-YOURLANG linenums highlight:2,4\"><br \/>\n  \/\/ line 2<br \/>\n  \/\/ line 3<br \/>\n  \/\/ line 4<br \/>\n<\/pre>\n<\/p>\n<p>Alternatively you can highlight one or several code segments:<\/p>\n<p><pre class=\"prettyprint lang-YOURLANG linenums highlight:1-3,5-6\"><br \/>\n  \/\/ line 2<br \/>\n  \/\/ line 3<br \/>\n  \/\/ line 4<br \/>\n  \/\/ line 5<br \/>\n<\/pre>\n<\/p>\n<p>Note: This feature is not available when line numbering is disabled.<\/p>\n<h3>Specifying Language<\/h3>\n<p>Most of the time the highlighter will do a good job guessing how to highlight the code. However, to achieve the best result, you should specify the language:<\/p>\n<p><pre class=\"prettyprint lang-YOURLANG\"><br \/>\n  \/\/ Put your code here.<br \/>\n<\/pre>\n<\/p>\n<p>Replace YOURLANG with one of the following:<\/p>\n<ul>\n<li>aea<\/li>\n<li>agc<\/li>\n<li>apollo<\/li>\n<li>bsh<\/li>\n<li>c<\/li>\n<li>cc<\/li>\n<li>cl<\/li>\n<li>cpp<\/li>\n<li>cs<\/li>\n<li>csh<\/li>\n<li>css-str<\/li>\n<li>cv<\/li>\n<li>cxx<\/li>\n<li>cyc<\/li>\n<li>default-markup<\/li>\n<li>el<\/li>\n<li>fs<\/li>\n<li>go<\/li>\n<li>hs<\/li>\n<li>htm<\/li>\n<li>html<\/li>\n<li>java<\/li>\n<li>js<\/li>\n<li>json<\/li>\n<li>lisp<\/li>\n<li>lua<\/li>\n<li>m<\/li>\n<li>ml<\/li>\n<li>mxml<\/li>\n<li>perl<\/li>\n<li>pl<\/li>\n<li>pm<\/li>\n<li>proto<\/li>\n<li>py<\/li>\n<li>rb<\/li>\n<li>scala<\/li>\n<li>scm<\/li>\n<li>sh<\/li>\n<li>sql<\/li>\n<li>vhd<\/li>\n<li>vhdl<\/li>\n<li>wiki<\/li>\n<li>xhtml<\/li>\n<li>xml<\/li>\n<li>xsl<\/li>\n<li>yaml<\/li>\n<li>yml<\/li>\n<\/ul>\n<h3>Shortcode<\/h3>\n<p>Here is a quick example. All the parameters are optional.<\/p>\n<p>[code lang=\u201dscala\u201d start=\u201d1\u2033 highlight=\u201d1-3,6,10-14\u2033 background=\u201d#C0FFB3\u2033]<br \/>\n  \/\/ Put your code here.<br \/>\n[\/code]<\/p>\n<p>Html quoting can be disabled as follows:<\/p>\n<p>[code quote=\u201dfalse\u201d]<br \/>\n  \/\/ Put your code here.<br \/>\n[\/code]<\/p>\n<p>The contents of shortcodes is auto-formatted by WP. As a result <\/p>\n<p> and <br \/> tags along<br \/>\nwith some formatting will be lost. If you need to preseve the original formatting use<br \/>\nhtml notation instead of the shortcode.<\/p>\n<h3>Please Support<\/h3>\n<p>If you like Prettify GC Syntax Highlighter plugin, please donate a minute of your time and vote for it. Thank you!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Your code will look exactly like it does on google-code.<\/p>\n","protected":false},"author":65,"featured_media":326944,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"slim_seo":{"title":"Prettify GC Syntax Highlighter - \u8587\u6653\u6735\u63d2\u4ef6\u76ee\u5f55","description":"Your code will look exactly like it does on google-code."},"footnotes":""},"categories":[1],"tags":[36707,13600,36708,3825],"class_list":["post-135359","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-google-code","tag-prettify","tag-prettify-js","tag-syntax-highlighter"],"_links":{"self":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts\/135359","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/users\/65"}],"replies":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/comments?post=135359"}],"version-history":[{"count":0,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts\/135359\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/media\/326944"}],"wp:attachment":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/media?parent=135359"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/categories?post=135359"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/tags?post=135359"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}