diff --git a/editor/package-lock.json b/editor/package-lock.json index e04e1cb..2d8685a 100644 --- a/editor/package-lock.json +++ b/editor/package-lock.json @@ -4602,6 +4602,14 @@ "verror": "1.10.0" } }, + "katex": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/katex/-/katex-0.6.0.tgz", + "integrity": "sha1-EkGOCRIcBckgQbazuftrqyE8tvM=", + "requires": { + "match-at": "^0.1.0" + } + }, "keycharm": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/keycharm/-/keycharm-0.3.1.tgz", @@ -4784,6 +4792,14 @@ "uc.micro": "^1.0.5" } }, + "markdown-it-katex": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/markdown-it-katex/-/markdown-it-katex-2.0.3.tgz", + "integrity": "sha1-17hqGuoLnWSW+rTnkZoY/e9YnDk=", + "requires": { + "katex": "^0.6.0" + } + }, "markdown-it-mark": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/markdown-it-mark/-/markdown-it-mark-3.0.0.tgz", @@ -4804,6 +4820,11 @@ "sanitize-filename": "^1.6.1" } }, + "match-at": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/match-at/-/match-at-0.1.1.tgz", + "integrity": "sha512-h4Yd392z9mST+dzc+yjuybOGFNOZjmXIPKWjxBd1Bb23r4SmDOsk2NYCU2BMUBGbSpZqwVsZYNq26QS3xfaT3Q==" + }, "math-random": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/math-random/-/math-random-1.0.4.tgz", diff --git a/editor/package.json b/editor/package.json index b62377a..e479c69 100644 --- a/editor/package.json +++ b/editor/package.json @@ -25,6 +25,7 @@ "keycharm": "^0.3.1", "lunr": "^2.3.8", "markdown-it": "^11.0.0", + "markdown-it-katex": "^2.0.3", "markdown-it-mark": "^3.0.0", "markdown-it-wikilinks": "^1.0.1", "mermaid": "^8.5.2", diff --git a/editor/src/index.js b/editor/src/index.js index 4ea6d81..1bd5401 100644 --- a/editor/src/index.js +++ b/editor/src/index.js @@ -2,6 +2,7 @@ import listEditor from 'wiki-list-editor'; import MarkdownIt from 'markdown-it'; import MarkdownItWikilinks from './wikilinks'; import MarkdownItMark from 'markdown-it-mark'; +import MarkdownItKatex from 'markdown-it-katex'; import axios from 'axios'; import qs from 'querystring' import $ from 'jquery'; @@ -207,12 +208,12 @@ if (holder) { htmlAttributes: { class: 'wiki-link' }, - })).use(MarkdownItMark) + })).use(MarkdownItMark).use(MarkdownItKatex) const options = { transform(text, element) { let converted = text - if (converted.startsWith("```", 0)) { + if (converted.startsWith("```", 0) || converted.startsWith("$$", 0)) { converted = MD.render(converted) } else { if (text.match(/^(\w+):: (.+)$/)) {