<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dr Nic &#187; Tumblr</title>
	<atom:link href="http://drnicwilliams.com/category/tumblr/feed/" rel="self" type="application/rss+xml" />
	<link>http://drnicwilliams.com</link>
	<description>Ruby makes Rails, Javascript makes Ajax, Dr Nic makes Magic</description>
	<lastBuildDate>Tue, 01 Jun 2010 12:54:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Syntax Highlighting in Tumblr</title>
		<link>http://drnicwilliams.com/2007/03/08/syntax-highlighting-in-tumblr/</link>
		<comments>http://drnicwilliams.com/2007/03/08/syntax-highlighting-in-tumblr/#comments</comments>
		<pubDate>Thu, 08 Mar 2007 13:53:49 +0000</pubDate>
		<dc:creator>Dr Nic</dc:creator>
				<category><![CDATA[Announcement]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Tumblr]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://drnicwilliams.com/2007/03/08/syntax-highlighting-in-tumblr/</guid>
		<description><![CDATA[I wrote an email to the lovely Tumblr people asking for Syntax Highlighting for code chunks. Several hours passed and they still hadn&#8217;t jumped at the chance to appease me with some syntax highlighting. So I wrote one, and so now all Tumblrers can use it. See the demo from my tumblr, and in a [...]


Related posts:<ol><li><a href='http://drnicwilliams.com/2007/03/05/dr-nics-tumblelog/' rel='bookmark' title='Permanent Link: Dr Nic&#8217;s Tumblelog'>Dr Nic&#8217;s Tumblelog</a> <small>Everyday I have 100s of blog articles to read [Ed:...</small></li></ol>]]></description>
			<content:encoded><![CDATA[<p>I wrote an email to the lovely <a href="http://tumblr.com">Tumblr</a> people asking for Syntax Highlighting for code chunks. Several hours passed and they still hadn&#8217;t jumped at the chance to appease me with some syntax highlighting.</p>
<p>So I wrote one, and so now all Tumblrers can use it.</p>
<p>See the <a href="http://drnic.tumblr.com/post/88697">demo from my tumblr</a>, and in a frame below:</p>
<p><iframe src="http://drnic.tumblr.com/post/88697" width=500 height=400></iframe></p>
<p>To use this in your own Tumblr (or probably anywhere I guess), do the following:</p>
<ol>
<li>Go to settings</li>
<li>At the bottom, turn off &#8216;Use rich text editing&#8217; and &#8216;Filter HTML&#8217;, and save settings.</li>
<li>Go back into settings, and select Custom theme. This will give you the raw html for your previously selected theme</li>
<li>Just above/before the <code>&lt;/head>&lt;body></code> section, insert these two lines of html</li>
</ol>
<textarea name="code" class="html" cols="60" rows="10">
&lt;link rel="stylesheet" type="text/css" href="http://drnicwilliams.com/external/CodeHighlighter/styles.css">&lt;/link>
&lt;script src="http://drnicwilliams.com/external/CodeHighlighter/clean_tumblr_pre.js">&lt;/script>
</textarea>
<ol start=5>
<li>This gives you support for Ruby, Javascript, CSS and HTML. To activate this for any &lt;pre> or &lt;code> block then merely assign a class of <code>ruby</code>, <code>javascript</code>, <code>css</code> or <code>html</code> to a <code>&lt;code></code> wrapper.</li>
</ol>
<p>For example, to set Javascript syntax in a &lt;pre> you still  need to include a &lt;code> inside:</p>
<pre>
&lt;pre>&lt;code class="javascript">function foo() {
  return "Dr Nic";
}
&lt;/code>&lt;/pre>
</pre>
<h3>Can I change the highlighting?</h3>
<p>Get the <a href="http://drnicwilliams.com/external/CodeHighlighter/styles.css">styles.css</a> file, change it, post it somewhere (or give it to me with a new name, and I&#8217;ll post it here), and change the <code>&lt;link href="...your dir/styles.css"></code> above.</p>
<h3>Can I support more languages?</h3>
<p>Grab the four language files (<a href="http://drnicwilliams.com/external/CodeHighlighter/css.js">css</a>, <a href="http://drnicwilliams.com/external/CodeHighlighter/ruby.js">ruby</a>, <a href="http://drnicwilliams.com/external/CodeHighlighter/javascript.js">javascript</a>, and <a href="http://drnicwilliams.com/external/CodeHighlighter/html.js">html</a>) and slap one together for module-2 if you like. Again, if you want me to host it here, just ping me. Also, email it to <a href="http://www.danwebb.net/">Dan Webb</a> so he can add it to his CodeHighlighter project.</p>
<h3>&#8220;I&#8217;m from Tumblr, we&#8217;ve just implemented syntax highlighting&#8221;</h3>
<p>*blank stare*</p>


<p>Related posts:<ol><li><a href='http://drnicwilliams.com/2007/03/05/dr-nics-tumblelog/' rel='bookmark' title='Permanent Link: Dr Nic&#8217;s Tumblelog'>Dr Nic&#8217;s Tumblelog</a> <small>Everyday I have 100s of blog articles to read [Ed:...</small></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://drnicwilliams.com/2007/03/08/syntax-highlighting-in-tumblr/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
	</channel>
</rss>
