Skip to content

Commit

Permalink
fix: fix the link path of the mention
Browse files Browse the repository at this point in the history
  • Loading branch information
ganta committed Oct 5, 2024
1 parent 802dc3c commit 1b6cd7c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/app/markdown/replacer/mention-replacer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class MentionReplacer {
};
return (
code
.replace(/[ @%&'"<>*]/g, replacer)
.replace(/[ @%&'"<>*+]/g, replacer)
// Escape Markdown syntax characters following a multi-bytes character.
.replace(/(?<!\w)[ _~![\]|\\-]/g, replacer)
);
Expand Down Expand Up @@ -107,7 +107,11 @@ class MentionReplacer {
if (!entity) return match;

const attrName = type ? `${type}-mention-id` : "mention-id";
const href = type ? "#" : `/k/#/people/user/${code}`;
const href = type
? "#"
: code.includes("@")
? `/k/guest/#/people/guest/${escapedCode}`
: `/k/#/people/user/${escapedCode}`;
// LRO/RLO may be included in `name`. Therefore, it is surrounded by bdi element.
return `<a class="${className}" href="${href}" data-${attrName}="${entity.id}" tabindex="-1" style="${style}">@<bdi>${entity.name}</bdi></a>`;
};
Expand Down

0 comments on commit 1b6cd7c

Please sign in to comment.