 
 formatEither = (isTitle, format, text, leaveTeX = false, bold = false) ->
   return text unless text?
-  text = formatSearch isTitle, text
 
   ## LaTeX and Markdown formats are special because they do their own math
   ## preprocessing at a specific time during its formatting.  Other formats

  text = postprocessCoauthorLinks text
  text = postprocessLinks text
  text = postprocessAtMentions text
  sanitize text

formatEitherSafe = (isTitle, format, text, leaveTeX = false, bold = false) ->

        pattern = query.title ? query.body
        unless pattern.$not
          pattern = new RegExp pattern, 'g' if pattern instanceof RegExp
          text = text.replace pattern, (match, ...args, offset, string, grps) ->
            return match if inTag string, offset
            """<span class="highlight">#{match}</span>"""
      for list in [query.$and, query.$or]
        continue unless list
        for part in list
