Prism.js Tcl

HTML

<script src="https://dl.dropboxusercontent.com/u/313630820/js/prism.js/prism.js"></script>
<link rel="stylesheet" href="https://dl.dropboxusercontent.com/u/313630820/js/prism.js/prism.css">
<pre><code class="language-tcl">proc RESTORE/post/:post_id/comment/:comment_id {post_id comment_id} {
    #| Restore a comment handler
    comment_restore $comment_id
    qc::actions redirect [url "/post/$post_id" show_deleted_comment_ids $comment_id]
}

# Helper functions

proc toggle_button {name value checked_value unchecked_value class } {
    #| Creates a toggle button switch.
    set temp ""
    append temp [h input id $name name $name type checkbox value $checked_value checked [expr {$value eq $checked_value}] ]
    append temp [h label for $name ""] 
    return [h div class $class $temp]
}

proc commonmark2html {args} {
    #| Converts Commonmark Markdown (http://commonmark.org) to  HTML.
    qc::args $args -unsafe -- markdown
    set markdown [string map {\r ""} $markdown] ;#removes ^M (alternative carriage return) characters
    set html [exec cmark << $markdown]
    if {[info exists unsafe]} {
        return $html
    } elseif { [qc::is safe_html $html] } {
        return $html
    } else {
        return -code error -errorcode CAST "Markdown contains unsafe HTML."
    }
}
proc test {} {
    global var
    ${foo bar} baz
    \# Not a comment
    "
    test
    "
    set foo \
    set bar
}
    </code>
</pre>

JavaScript

Prism.languages.tcl = {
	'escaped': /\\./g,
	'comment': /#.*/g,
	'string': /"[^"]*"/g,
	'variable': [
		{
			pattern: /(\$)(::)?([a-zA-Z0-9]+::)*[a-zA-Z0-9_]+/g,
			lookbehind: true
		},
		{
			pattern: /(\$){[^}]+}/g,
			lookbehind: true
		},
		{
			pattern: /(^\s*set\s+)(::)?([a-zA-Z0-9]+::)*[a-zA-Z0-9_]+/gm,
			lookbehind: true
		}
	],
	'function': {
		lookbehind: true,
		pattern: /(^\s*proc\s+)[^\s]+/gm
	},
	'builtin': [
		{
			pattern: /(^\s*)(proc|return|class|error|eval|exit)\b/gm,
			lookbehind: true
		},
		{
			pattern: /(^\s*)(for|foreach|if|switch|while|break|continue)\b/gm,
			lookbehind: true
		},
		/\b(elseif|else)\b/g
	],
	'scope': {
		pattern: /^\s+(global|upvar|variable)\b/gm,
		alias: 'constant'
	},
	'keyword': [
		{
			pattern: /(^\s*|\[)(after|append|apply|array|auto_execok|auto_import)\b/gm,
			lookbehind: true
		},
		{
			pattern: /(^\s*|\[)(auto_load|auto_mkindex|automkindex_old)\b/gm,
			lookbehind: true
		},
		{
			pattern: /(^\s*|\[)(auto_qualify|auto_reset|bgerror|binary|catch|cd)\b/gm,
			lookbehind: true
		},
		{
			pattern: /(^\s*|\[)(chan|clock|close|concat|dde|dict|encoding|eof)\b/gm,
			lookbehind: true
		},
		{
			pattern: /(^\s*|\[)(exec|exit|expr|fblocked|fconfigure|fcopy|file)\b/gm,
			lookbehind: true
		},
		{
			pattern: /(^\s*|\[)(fileevent|filename|flush|gets|glob|history)\b/gm,
			lookbehind: true
		},
		{
			pattern: /(^\s*|\[)(http|incr|info|interp|join|lappend|lassign)\b/gm,
			lookbehind: true
		},
		{
			pattern: /(^\s*|\[)(lindex|linsert|list|llength|load|lrange)\b/gm,
			lookbehind: true
		},
		{
			pattern: /(^\s*|\[)(lrepeat|lreplace|lreverse|lsearch|lset|lsort)\b/gm,
			lookbehind: true
		},
		{
			pattern: /(^\s*|\[)(mathfunc|mathop|memory|msgcat|namespace|open)\b/gm,
			lookbehind: true
		},
		{
			pattern: /(^\s*|\[)(package|parray|pid|pkg_mkIndex|platform|puts)\b/gm,
			lookbehind: true
		},
		{
			pattern: /(^\s*|\[)(pwd|re_syntax|read|refchan|regexp|registry)\b/gm,
			lookbehind: true
		},
		{
			pattern:...