Commit 0868aefe by Ibrahim Awwal Committed by Matthew Mongeau

Fix markdown in thread bodies and comments.

parent f796c030
...@@ -54,7 +54,7 @@ class @DiscussionThreadInlineView extends DiscussionContentView ...@@ -54,7 +54,7 @@ class @DiscussionThreadInlineView extends DiscussionContentView
convertMath: -> convertMath: ->
element = @$(".post-body") element = @$(".post-body")
element.html DiscussionUtil.postMathJaxProcessor(element.html()) element.html DiscussionUtil.postMathJaxProcessor DiscussionUtil.markdownWithHighlight element.html()
MathJax.Hub.Queue ["Typeset", MathJax.Hub, element[0]] MathJax.Hub.Queue ["Typeset", MathJax.Hub, element[0]]
renderResponses: -> renderResponses: ->
......
...@@ -43,7 +43,7 @@ class @DiscussionThreadView extends DiscussionContentView ...@@ -43,7 +43,7 @@ class @DiscussionThreadView extends DiscussionContentView
convertMath: -> convertMath: ->
element = @$(".post-body") element = @$(".post-body")
element.html DiscussionUtil.postMathJaxProcessor(element.html()) element.html DiscussionUtil.postMathJaxProcessor DiscussionUtil.markdownWithHighlight element.html()
MathJax.Hub.Queue ["Typeset", MathJax.Hub, element[0]] MathJax.Hub.Queue ["Typeset", MathJax.Hub, element[0]]
renderResponses: -> renderResponses: ->
......
...@@ -2,6 +2,7 @@ class @ResponseCommentView extends DiscussionContentView ...@@ -2,6 +2,7 @@ class @ResponseCommentView extends DiscussionContentView
tagName: "li" tagName: "li"
template: _.template($("#response-comment-template").html()) template: _.template($("#response-comment-template").html())
initLocal: -> initLocal: ->
# TODO .response-local is the parent of the comments so @$local is null, not sure what was intended here...
@$local = @$el.find(".response-local") @$local = @$el.find(".response-local")
@$delegateElement = @$local @$delegateElement = @$local
...@@ -14,8 +15,9 @@ class @ResponseCommentView extends DiscussionContentView ...@@ -14,8 +15,9 @@ class @ResponseCommentView extends DiscussionContentView
@convertMath() @convertMath()
@ @
convertMath: -> convertMath: ->
body = @$(".response-body") body = @$el.find(".response-body")
body.html DiscussionUtil.postMathJaxProcessor DiscussionUtil.markdownWithHighlight body.html() body.html DiscussionUtil.postMathJaxProcessor DiscussionUtil.markdownWithHighlight body.html()
# This removes paragraphs so that comments are more compact
body.children("p").each (index, elem) -> body.children("p").each (index, elem) ->
$(elem).replaceWith($(elem).html()) $(elem).replaceWith($(elem).html())
MathJax.Hub.Queue ["Typeset", MathJax.Hub, body[0]] MathJax.Hub.Queue ["Typeset", MathJax.Hub, body[0]]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment