{"id":41,"date":"2009-08-25T21:37:07","date_gmt":"2009-08-25T19:37:07","guid":{"rendered":"http:\/\/bininda.com\/blog\/?p=41"},"modified":"2009-10-07T09:12:09","modified_gmt":"2009-10-07T07:12:09","slug":"syntax-highlighting-and-printing","status":"publish","type":"post","link":"http:\/\/bininda.com\/blog\/2009\/08\/syntax-highlighting-and-printing\/","title":{"rendered":"Syntax Highlighting and Printing"},"content":{"rendered":"<p>I installed a <a title=\"WordPress\" href=\"http:\/\/wordpress.org\/\">WordPress<\/a> plugin for syntax highlighting of code blocks today. <a title=\"The Last Engine\" href=\"http:\/\/www.lastengine.com\/syntax-highlighter-wordpress-plugin\/\">The plugin I installed<\/a> uses JavaScript to do the highlighting and has a additional <em>view source<\/em> and <em>print<\/em> buttons, which is nice. Especially the view source button allows for easy cut and paste.<\/p>\n<p>I also made the blog printer friendly by adding a special style sheet for printing. Good documentation for doing this can be found on the <a title=\"Styling for Print\" href=\"http:\/\/codex.wordpress.org\/Styling_for_Print\">WordPress site<\/a>.<\/p>\n<pre class=\"brush: html\">&lt;link rel=\"stylesheet\" type=\"text\/css\" media=\"screen\"\r\n  href=\"&lt;?php bloginfo('stylesheet_url'); ?&gt;\" \/&gt;\r\n&lt;link rel=\"stylesheet\" type=\"text\/css\" media=\"print\"\r\n  href=\"&lt;?php bloginfo('stylesheet_directory'); ?&gt;\/print.css\" \/&gt;<\/pre>\n<p>the <em>print.css<\/em> stylesheet looks like this:<\/p>\n<pre class=\"brush: css; collapse:true\">body {background:white;\r\n     font-size:10pt;\r\n     margin:0 }\r\n#sidebar { display:none }\r\n#header { display:none }\r\n.content-sidebar { display: none }\r\n.next_previous_link { display: none }\r\n.subscribe_comments { display: none }\r\n.nr_comm { display: none }\r\n.edit_content { display: none }\r\n#content{ margin-left:0;\r\n     float:none;\r\n     width:auto }\r\n.demo .red { color:black;\r\n     font-weight:bold }\r\n#content a { font-weight:bold;\r\n     color:#000066;\r\n     text-decoration:underline }\r\n#content{ margin-left:0;\r\n     float:none;\r\n     width:auto }\r\n#respond{ display: none }\r\n#footer, .ad { display:none }\r\nh1, h2, h3, h4, h5, h6 { page-break-after:avoid;\r\n     page-break-inside:avoid }\r\nh3 { margin-left:10px;\r\n     margin-bottom:0px;\r\n     padding-bottom:0px }\r\nblockquote, table, pre { page-break-inside:avoid }\r\nul, ol, dl  { page-break-before:avoid }\r\nimg.centered { display: block;\r\n     margin-left: auto;\r\n     margin-right: auto; }\r\nimg.right { padding: 4px;\r\n     margin: 0 0 2px 7px;\r\n     display: inline; }\r\nimg.left { padding: 4px;\r\n     margin: 0 7px 2px 0;\r\n     display: inline; }\r\n.right { float: right; }\r\n.left { float: left }\r\nimg { page-break-inside:avoid;\r\n     page-break-after:avoid; }<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I installed a WordPress plugin for syntax highlighting of code blocks today. The plugin I installed uses JavaScript to do the highlighting and has a additional view source and print buttons, which is nice. Especially the view source button allows for easy cut and paste. I also made the blog printer friendly by adding a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23],"tags":[13,14,15,6],"_links":{"self":[{"href":"http:\/\/bininda.com\/blog\/wp-json\/wp\/v2\/posts\/41"}],"collection":[{"href":"http:\/\/bininda.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bininda.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bininda.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/bininda.com\/blog\/wp-json\/wp\/v2\/comments?post=41"}],"version-history":[{"count":12,"href":"http:\/\/bininda.com\/blog\/wp-json\/wp\/v2\/posts\/41\/revisions"}],"predecessor-version":[{"id":46,"href":"http:\/\/bininda.com\/blog\/wp-json\/wp\/v2\/posts\/41\/revisions\/46"}],"wp:attachment":[{"href":"http:\/\/bininda.com\/blog\/wp-json\/wp\/v2\/media?parent=41"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bininda.com\/blog\/wp-json\/wp\/v2\/categories?post=41"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bininda.com\/blog\/wp-json\/wp\/v2\/tags?post=41"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}