This is a bookmarklet to wrap code in a textarea with the appropriate highlight.js elements. Simply select the code in a text field then activate the bookmarklet. There will be a prompt to enter the language. This will only work on sites that have highlight.js installed.
(function (d) {
var a = d.activeElement,
t = a.value,
s = a.selectionStart,
e = a.selectionEnd,
l = prompt('Input language');
a.value = t.slice(0, s) + '<pre><code class="' + l.toLowerCase().replace(/\s*/g,'').replace('#','s') + '">' + t.slice(s, e) + '</code></pre>' + t.slice(e);
}(document));
Save the "URL" below as bookmark.
javascript:(function(d){var a=d.activeElement,t=a.value,s=a.selectionStart,e=a.selectionEnd,l=prompt('Input language');a.value=t.slice(0,s)+'<pre><code class="'+l.toLowerCase().replace(/\s*/g,'').replace('#','s')+'">'+t.slice(s,e)+'</code></pre>'+t.slice(e);}(document));