mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
fix: tag regex (#76)
* fix: tag regex * fix: tag styles * chore: remove usused codes
This commit is contained in:
@ -160,13 +160,6 @@ export function formatMemoContent(content: string) {
|
||||
|
||||
content = parseMarkedToHtml(content);
|
||||
|
||||
content = content.replace(IMAGE_URL_REG, "");
|
||||
|
||||
content = content
|
||||
.replace(TAG_REG, "<span class='tag-span'>#$1</span>")
|
||||
.replace(LINK_REG, "<a class='link' target='_blank' rel='noreferrer' href='$1'>$1</a>")
|
||||
.replace(MEMO_LINK_REG, "<span class='memo-link-text' data-value='$2'>$1</span>");
|
||||
|
||||
// Add space in english and chinese
|
||||
content = content.replace(/([\u4e00-\u9fa5])([A-Za-z0-9?.,;[\]]+)/g, "$1 $2").replace(/([A-Za-z0-9?.,;[\]]+)([\u4e00-\u9fa5])/g, "$1 $2");
|
||||
|
||||
@ -182,7 +175,11 @@ export function formatMemoContent(content: string) {
|
||||
}
|
||||
}
|
||||
|
||||
return tempDivContainer.innerHTML;
|
||||
return tempDivContainer.innerHTML
|
||||
.replace(IMAGE_URL_REG, "")
|
||||
.replace(TAG_REG, "<span class='tag-span'>#$1</span> ")
|
||||
.replace(LINK_REG, "<a class='link' target='_blank' rel='noreferrer' href='$1'>$1</a>")
|
||||
.replace(MEMO_LINK_REG, "<span class='memo-link-text' data-value='$2'>$1</span>");
|
||||
}
|
||||
|
||||
export default memo(Memo);
|
||||
|
Reference in New Issue
Block a user