Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Anything Llm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
MachineLearning
Mintplex Labs
Anything Llm
Commits
b4f80c3b
Unverified
Commit
b4f80c3b
authored
8 months ago
by
Timothy Carambat
Committed by
GitHub
8 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Add support for markdown/math equations (#2062)
parent
0141f91d
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
frontend/package.json
+1
-0
1 addition, 0 deletions
frontend/package.json
frontend/src/index.css
+9
-0
9 additions, 0 deletions
frontend/src/index.css
frontend/src/utils/chat/markdown.js
+2
-1
2 additions, 1 deletion
frontend/src/utils/chat/markdown.js
frontend/yarn.lock
+19
-0
19 additions, 0 deletions
frontend/yarn.lock
with
31 additions
and
1 deletion
frontend/package.json
+
1
−
0
View file @
b4f80c3b
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
"js-levenshtein"
:
"^1.1.6"
,
"js-levenshtein"
:
"^1.1.6"
,
"lodash.debounce"
:
"^4.0.8"
,
"lodash.debounce"
:
"^4.0.8"
,
"markdown-it"
:
"^13.0.1"
,
"markdown-it"
:
"^13.0.1"
,
"markdown-it-katex"
:
"^2.0.3"
,
"moment"
:
"^2.30.1"
,
"moment"
:
"^2.30.1"
,
"pluralize"
:
"^8.0.0"
,
"pluralize"
:
"^8.0.0"
,
"react"
:
"^18.2.0"
,
"react"
:
"^18.2.0"
,
...
...
This diff is collapsed.
Click to expand it.
frontend/src/index.css
+
9
−
0
View file @
b4f80c3b
...
@@ -794,3 +794,12 @@ does not extend the close button beyond the viewport. */
...
@@ -794,3 +794,12 @@ does not extend the close button beyond the viewport. */
top
:
-3.5rem
;
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
;
}
This diff is collapsed.
Click to expand it.
frontend/src/utils/chat/markdown.js
+
2
−
1
View file @
b4f80c3b
import
{
encode
as
HTMLEncode
}
from
"
he
"
;
import
{
encode
as
HTMLEncode
}
from
"
he
"
;
import
markdownIt
from
"
markdown-it
"
;
import
markdownIt
from
"
markdown-it
"
;
import
markdownItKatex
from
"
markdown-it-katex
"
;
import
hljs
from
"
highlight.js
"
;
import
hljs
from
"
highlight.js
"
;
import
"
highlight.js/styles/github-dark-dimmed.min.css
"
;
import
"
highlight.js/styles/github-dark-dimmed.min.css
"
;
import
{
v4
}
from
"
uuid
"
;
import
{
v4
}
from
"
uuid
"
;
...
@@ -43,7 +44,7 @@ const markdown = markdownIt({
...
@@ -43,7 +44,7 @@ const markdown = markdownIt({
"
</pre></div>
"
"
</pre></div>
"
);
);
},
},
});
})
.
use
(
markdownItKatex
)
;
export
default
function
renderMarkdown
(
text
=
""
)
{
export
default
function
renderMarkdown
(
text
=
""
)
{
return
markdown
.
render
(
text
);
return
markdown
.
render
(
text
);
...
...
This diff is collapsed.
Click to expand it.
frontend/yarn.lock
+
19
−
0
View file @
b4f80c3b
...
@@ -2347,6 +2347,13 @@ json5@^2.2.3:
...
@@ -2347,6 +2347,13 @@ json5@^2.2.3:
object.assign "^4.1.4"
object.assign "^4.1.4"
object.values "^1.1.6"
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:
keyv@^4.5.3:
version "4.5.4"
version "4.5.4"
resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93"
resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93"
...
@@ -2425,6 +2432,13 @@ lru-cache@^5.1.1:
...
@@ -2425,6 +2432,13 @@ lru-cache@^5.1.1:
dependencies:
dependencies:
yallist "^3.0.2"
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:
markdown-it@^13.0.1:
version "13.0.2"
version "13.0.2"
resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-13.0.2.tgz#1bc22e23379a6952e5d56217fbed881e0c94d536"
resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-13.0.2.tgz#1bc22e23379a6952e5d56217fbed881e0c94d536"
...
@@ -2436,6 +2450,11 @@ markdown-it@^13.0.1:
...
@@ -2436,6 +2450,11 @@ markdown-it@^13.0.1:
mdurl "^1.0.1"
mdurl "^1.0.1"
uc.micro "^1.0.5"
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:
mdurl@^1.0.1:
version "1.0.1"
version "1.0.1"
resolved "https://registry.yarnpkg.com/mdurl/-/mdurl-1.0.1.tgz#fe85b2ec75a59037f2adfec100fd6c601761152e"
resolved "https://registry.yarnpkg.com/mdurl/-/mdurl-1.0.1.tgz#fe85b2ec75a59037f2adfec100fd6c601761152e"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment