mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2025-05-02 17:07:13 +00:00
Add support for markdown/math equations (#2062)
This commit is contained in:
parent
0141f91dda
commit
b4f80c3be2
4 changed files with 31 additions and 1 deletions
frontend
|
@ -24,6 +24,7 @@
|
|||
"js-levenshtein": "^1.1.6",
|
||||
"lodash.debounce": "^4.0.8",
|
||||
"markdown-it": "^13.0.1",
|
||||
"markdown-it-katex": "^2.0.3",
|
||||
"moment": "^2.30.1",
|
||||
"pluralize": "^8.0.0",
|
||||
"react": "^18.2.0",
|
||||
|
|
|
@ -794,3 +794,12 @@ does not extend the close button beyond the viewport. */
|
|||
top: -3.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* Math/Katex formatting to prevent duplication of content on screen */
|
||||
.katex-html[aria-hidden="true"] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.katex-mathml {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { encode as HTMLEncode } from "he";
|
||||
import markdownIt from "markdown-it";
|
||||
import markdownItKatex from "markdown-it-katex";
|
||||
import hljs from "highlight.js";
|
||||
import "highlight.js/styles/github-dark-dimmed.min.css";
|
||||
import { v4 } from "uuid";
|
||||
|
@ -43,7 +44,7 @@ const markdown = markdownIt({
|
|||
"</pre></div>"
|
||||
);
|
||||
},
|
||||
});
|
||||
}).use(markdownItKatex);
|
||||
|
||||
export default function renderMarkdown(text = "") {
|
||||
return markdown.render(text);
|
||||
|
|
|
@ -2347,6 +2347,13 @@ json5@^2.2.3:
|
|||
object.assign "^4.1.4"
|
||||
object.values "^1.1.6"
|
||||
|
||||
katex@^0.6.0:
|
||||
version "0.6.0"
|
||||
resolved "https://registry.yarnpkg.com/katex/-/katex-0.6.0.tgz#12418e09121c05c92041b6b3b9fb6bab213cb6f3"
|
||||
integrity sha512-rS4mY3SvHYg5LtQV6RBcK0if7ur6plyEukAOV+jGGPqFImuzu8fHL6M752iBmRGoUyF0bhZbAPoezehn7xYksA==
|
||||
dependencies:
|
||||
match-at "^0.1.0"
|
||||
|
||||
keyv@^4.5.3:
|
||||
version "4.5.4"
|
||||
resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93"
|
||||
|
@ -2425,6 +2432,13 @@ lru-cache@^5.1.1:
|
|||
dependencies:
|
||||
yallist "^3.0.2"
|
||||
|
||||
markdown-it-katex@^2.0.3:
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/markdown-it-katex/-/markdown-it-katex-2.0.3.tgz#d7b86a1aea0b9d6496fab4e7919a18fdef589c39"
|
||||
integrity sha512-nUkkMtRWeg7OpdflamflE/Ho/pWl64Lk9wNBKOmaj33XkQdumhXAIYhI0WO03GeiycPCsxbmX536V5NEXpC3Ng==
|
||||
dependencies:
|
||||
katex "^0.6.0"
|
||||
|
||||
markdown-it@^13.0.1:
|
||||
version "13.0.2"
|
||||
resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-13.0.2.tgz#1bc22e23379a6952e5d56217fbed881e0c94d536"
|
||||
|
@ -2436,6 +2450,11 @@ markdown-it@^13.0.1:
|
|||
mdurl "^1.0.1"
|
||||
uc.micro "^1.0.5"
|
||||
|
||||
match-at@^0.1.0:
|
||||
version "0.1.1"
|
||||
resolved "https://registry.yarnpkg.com/match-at/-/match-at-0.1.1.tgz#25d040d291777704d5e6556bbb79230ec2de0540"
|
||||
integrity sha512-h4Yd392z9mST+dzc+yjuybOGFNOZjmXIPKWjxBd1Bb23r4SmDOsk2NYCU2BMUBGbSpZqwVsZYNq26QS3xfaT3Q==
|
||||
|
||||
mdurl@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/mdurl/-/mdurl-1.0.1.tgz#fe85b2ec75a59037f2adfec100fd6c601761152e"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue