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