Skip to content

Commit

Permalink
Merge branch 'master' into pipertts-support
Browse files Browse the repository at this point in the history
  • Loading branch information
timothycarambat authored Aug 7, 2024
2 parents 31df75d + b4f80c3 commit 7393645
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 1 deletion.
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,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",
"onnxruntime-web": "^1.18.0",
"pluralize": "^8.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import useUser from "@/hooks/useUser";
import { PaperclipHorizontal } from "@phosphor-icons/react";
import { Tooltip } from "react-tooltip";

Expand All @@ -6,6 +7,9 @@ import { Tooltip } from "react-tooltip";
* @returns
*/
export default function AttachItem() {
const { user } = useUser();
if (!!user && user.role === "default") return null;

return (
<>
<button
Expand Down
9 changes: 9 additions & 0 deletions frontend/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
3 changes: 2 additions & 1 deletion frontend/src/utils/chat/markdown.js
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -43,7 +44,7 @@ const markdown = markdownIt({
"</pre></div>"
);
},
});
}).use(markdownItKatex);

export default function renderMarkdown(text = "") {
return markdown.render(text);
Expand Down
19 changes: 19 additions & 0 deletions frontend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2422,6 +2422,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"
Expand Down Expand Up @@ -2505,6 +2512,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"
Expand All @@ -2516,6 +2530,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"
Expand Down

0 comments on commit 7393645

Please sign in to comment.