Install Katex
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Peter Stuifzand 2020-07-06 01:08:14 +02:00
parent 64f7ebe8f9
commit e6345edef9
3 changed files with 25 additions and 2 deletions

View File

@ -4602,6 +4602,14 @@
"verror": "1.10.0" "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": { "keycharm": {
"version": "0.3.1", "version": "0.3.1",
"resolved": "https://registry.npmjs.org/keycharm/-/keycharm-0.3.1.tgz", "resolved": "https://registry.npmjs.org/keycharm/-/keycharm-0.3.1.tgz",
@ -4784,6 +4792,14 @@
"uc.micro": "^1.0.5" "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": { "markdown-it-mark": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/markdown-it-mark/-/markdown-it-mark-3.0.0.tgz", "resolved": "https://registry.npmjs.org/markdown-it-mark/-/markdown-it-mark-3.0.0.tgz",
@ -4804,6 +4820,11 @@
"sanitize-filename": "^1.6.1" "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": { "math-random": {
"version": "1.0.4", "version": "1.0.4",
"resolved": "https://registry.npmjs.org/math-random/-/math-random-1.0.4.tgz", "resolved": "https://registry.npmjs.org/math-random/-/math-random-1.0.4.tgz",

View File

@ -25,6 +25,7 @@
"keycharm": "^0.3.1", "keycharm": "^0.3.1",
"lunr": "^2.3.8", "lunr": "^2.3.8",
"markdown-it": "^11.0.0", "markdown-it": "^11.0.0",
"markdown-it-katex": "^2.0.3",
"markdown-it-mark": "^3.0.0", "markdown-it-mark": "^3.0.0",
"markdown-it-wikilinks": "^1.0.1", "markdown-it-wikilinks": "^1.0.1",
"mermaid": "^8.5.2", "mermaid": "^8.5.2",

View File

@ -2,6 +2,7 @@ import listEditor from 'wiki-list-editor';
import MarkdownIt from 'markdown-it'; import MarkdownIt from 'markdown-it';
import MarkdownItWikilinks from './wikilinks'; import MarkdownItWikilinks from './wikilinks';
import MarkdownItMark from 'markdown-it-mark'; import MarkdownItMark from 'markdown-it-mark';
import MarkdownItKatex from 'markdown-it-katex';
import axios from 'axios'; import axios from 'axios';
import qs from 'querystring' import qs from 'querystring'
import $ from 'jquery'; import $ from 'jquery';
@ -207,12 +208,12 @@ if (holder) {
htmlAttributes: { htmlAttributes: {
class: 'wiki-link' class: 'wiki-link'
}, },
})).use(MarkdownItMark) })).use(MarkdownItMark).use(MarkdownItKatex)
const options = { const options = {
transform(text, element) { transform(text, element) {
let converted = text let converted = text
if (converted.startsWith("```", 0)) { if (converted.startsWith("```", 0) || converted.startsWith("$$", 0)) {
converted = MD.render(converted) converted = MD.render(converted)
} else { } else {
if (text.match(/^(\w+):: (.+)$/)) { if (text.match(/^(\w+):: (.+)$/)) {