|
|
|
@ -21,6 +21,9 @@ import 'prismjs/components/prism-markup-templating'
|
|
|
|
|
import 'prismjs/components/prism-jq'
|
|
|
|
|
import MD from './markdown'
|
|
|
|
|
import he from 'he'
|
|
|
|
|
import {all, create} from 'mathjs'
|
|
|
|
|
|
|
|
|
|
const math = create(all)
|
|
|
|
|
|
|
|
|
|
function isMultiline(input) {
|
|
|
|
|
return input.value.startsWith("```", 0)
|
|
|
|
@ -153,12 +156,12 @@ function Editor(holder, input) {
|
|
|
|
|
|
|
|
|
|
if (converted.startsWith("```", 0) || converted.startsWith("$$", 0)) {
|
|
|
|
|
converted = MD.render(converted)
|
|
|
|
|
// } else if (converted.startsWith("=", 0)) {
|
|
|
|
|
// try {
|
|
|
|
|
// converted = math.evaluate(converted.substring(1), scope).toString()
|
|
|
|
|
// } catch (e) {
|
|
|
|
|
// converted = converted + ' <span style="background: red; color: white;">' + e.message + '</span>';
|
|
|
|
|
// }
|
|
|
|
|
} else if (converted.startsWith("=", 0)) {
|
|
|
|
|
try {
|
|
|
|
|
converted = math.evaluate(converted.substring(1), scope).toString()
|
|
|
|
|
} catch (e) {
|
|
|
|
|
converted = converted + ' <span style="background: red; color: white;">' + e.message + '</span>';
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (text.match(/^(\w+):: (.+)$/)) {
|
|
|
|
|
converted = converted.replace(/^(\w+):: (.*)$/, '**[[$1]]**: $2')
|
|
|
|
|