Skip to content

Commit

Permalink
fix link rendering in rich context #163
Browse files Browse the repository at this point in the history
  • Loading branch information
juzeon committed Dec 24, 2023
1 parent 766fea6 commit 6cc5d05
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions frontend/src/components/index/RichChatContext.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ function renderMD(content: string) {
renderer.text = function (text) {
return original_text(replace_math_with_ids(text))
}
const original_link = renderer.link
renderer.link = function (href, title, text) {
if (href === text) {
return '<' + href + '>'
}
return original_link(href, title, text)
}
const rendered_md_only = marked.parse(content, {renderer: renderer}) as string
try {
return rendered_md_only.replace(/(__special_katext_id_\d+__)/g, (_match, capture) => {
Expand Down

0 comments on commit 6cc5d05

Please sign in to comment.