 
 postprocessLinks = (text) ->
   text.replace urlRe, (match, offset, string) ->
+    #console.log string, offset, inTag string, offset
     if inTag string, offset
       match
     else

    text

@inTag = (string, offset) ->
  open = string.lastIndexOf '<', offset
  if open >= 0
    close = string.lastIndexOf '>', offset

      format: format
      active: if Template.currentData()?.format == format then 'active' else ''
      capitalized: capitalize format

escapeForHTML = (s) ->
  s
  .replace /&/g, '&amp;'
  .replace /</g, '&lt;'
  .replace />/g, '&gt;'

escapeForQuotedHTML = (s) ->
  escapeForHTML s
  .replace /"/g, '&quot;'

## Finds all $...$ and $$...$$ blocks, where ... properly deals with balancing
## braces (e.g. $\hbox{$x$}$) and escaped dollar signs (\$ doesn't count as $),
