Add in mathjax directive

This commit is contained in:
James Allen 2014-07-17 13:23:43 +01:00
parent 361fe310ce
commit a3faaf0c18
4 changed files with 30 additions and 1 deletions

View file

@ -33,7 +33,10 @@ aside.chat(
}"
)
.arrow(ng-style="{'border-color': 'hsl({{ hue(message.user) }}, 60%, 80%)'}")
p(ng-repeat="content in message.contents track by $index") {{ content }}
p(
mathjax,
ng-repeat="content in message.contents track by $index"
) {{ content }}
.new-message
textarea(

View file

@ -0,0 +1,24 @@
define [
"base"
"mathjax"
], (App) ->
mathjaxConfig =
"HTML-CSS": { availableFonts: ["TeX"] },
TeX:
equationNumbers: { autoNumber: "AMS" },
useLabelIDs: false
tex2jax:
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
processEscapes: true
MathJax.Hub.Config(mathjaxConfig);
App.directive "mathjax", () ->
return {
link: (scope, element, attrs) ->
setTimeout () ->
MathJax.Hub.Queue(["Typeset", MathJax.Hub, element.get(0)])
, 0
}

View file

@ -2,4 +2,5 @@ define [
"ide/chat/controllers/ChatButtonController"
"ide/chat/controllers/ChatController"
"ide/chat/controllers/ChatMessageController"
"ide/chat/directives/mathjax"
], () ->

View file

@ -76,6 +76,7 @@ define [
prependMessage(message)
appendMessage = (message) ->
console.log "MESSAGES", message, chat.state.messages
chat.state.newMessage = message
lastMessage = chat.state.messages[chat.state.messages.length - 1]