                     # 'raw' url. later, embed_videos will be replace by the data-uri if there is no error
                     out += "<video src='#{mesg.file.url}' class='sagews-output-video' controls></video>"
                 else
-                    # console.log 'msg.file', mark, mesg
+                    # if DEBUG then console.log 'msg.file', mark, mesg
                     if not @_output_ids[mark.id] # avoid duplicated outputs
                         @_output_ids[mark.id] = true
-                        # console.log "output.file", mark, mesg
+                        # if DEBUG then console.log "output.file", mark, mesg
                         $images = $(mark.widgetNode)
                         for el in $images.find('.sagews-output-image')
                             # innerHTML should just be the <img ... > element

    html_process_output_mesg: (mesg, mark) ->
        # Note: each mesg could contain more than one output type
        out = ''
        # console.log 'html_process_output_mesg', mesg, mark
        if mesg.stdout?
            # assertion: for stdout, `mark` might be undefined
            out += "<div class='output stdout'>#{mesg.stdout}</div>"
        if mesg.stderr?
            out += "<div class='output stderr'>#{mesg.stderr}</div>"
        if mesg.html?

            input_lines_mode = null

        # stdout mesg can be split up into multiple parts -- this is a helper for collecting them
        mesg_stdout = {stdout : []}
        process_collected_mesg_stdout = =>
            # processing leftover stdout mesgs from previous iteration
            if mesg_stdout.stdout.length > 0
                # it's ok to leave `mark` undefined
                om = @html_process_output_mesg(mesg_stdout)
                _html.push(om) if om?
                mesg_stdout = {stdout : []}

        process_lines = (cb) =>
            # process lines in an async loop to avoid blocking on large documents
