     _update_mathjax: (cb) ->
         if not @_isMounted  # see https://github.com/sagemathinc/smc/issues/1689
             return
-        #if DEBUG then console.log('Markdown._update_mathjax: @_x?.has_mathjax', @_x?.has_mathjax, @_x)
-        if @_x?.has_mathjax
+        if @props.has_mathjax
             $(ReactDOM.findDOMNode(@)).mathjax
                 cb : () =>
                     # Awkward code, since cb may be called more than once.

        # and https://github.com/sagemathinc/smc/issues/1689
        @_isMounted = false

    to_html: ->
        if @props.value
            # change escaped characters back for markdown processing
            v = @props.value.replace(/&gt;/g, '>').replace(/&lt;/g, '<')
            @_x = markdown.markdown_to_html(v)
            html_sane = require('./misc_page').sanitize_html(@_x.s)
            #if DEBUG then console.log('Markdown.to_html @_x', @_x)
            {__html: html_sane}
        else
            {__html: ''}

    render: ->
        <span
            className               = {@props.className}
            dangerouslySetInnerHTML = {@to_html()}
            style                   = {@props.style}>
        </span>

activity_style =
    float           : 'right'

                <div onClick={@edit} dangerouslySetInnerHTML={@to_html()}></div>
            </div>

exports.HTML = rclass
    displayName : 'Misc-HTML'

    propTypes :
        value       : rtypes.string
        style       : rtypes.object
        has_mathjax : rtypes.bool
        project_id  : rtypes.string   # optional -- can be used to improve link handling (e.g., to images)
        file_path   : rtypes.string   # optional -- ...
        className   : rtypes.string   # optional class

    getDefaultProps: ->
        has_mathjax : true

    shouldComponentUpdate: (newProps) ->
        return @props.value != newProps.value or not underscore.isEqual(@props.style, newProps.style)
