minor fixes
This commit is contained in:
@@ -41,10 +41,7 @@ export function noteParser(event: Event) {
|
||||
|
||||
// map hashtag to em
|
||||
content.original.match(/#(\w+)(?!:\/\/)/g)?.forEach((item) => {
|
||||
content.parsed = content.parsed.replace(
|
||||
item,
|
||||
` [${item}](https://primal.net/search/${item})`,
|
||||
);
|
||||
content.parsed = content.parsed.replace(item, `[${item}](/search/${item})`);
|
||||
});
|
||||
|
||||
// handle nostr mention
|
||||
@@ -58,7 +55,10 @@ export function noteParser(event: Event) {
|
||||
}
|
||||
|
||||
if (profile) {
|
||||
content.parsed = content.parsed.replace(item.text, `*${profile.pubkey}*`);
|
||||
content.parsed = content.parsed.replace(
|
||||
item.text,
|
||||
`[${profile.pubkey}](/user?pubkey=${profile.pubkey})`,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import destr from "destr";
|
||||
|
||||
export function truncateContent(str, n) {
|
||||
return str.length > n ? `${str.slice(0, n - 1)}…` : str;
|
||||
}
|
||||
|
||||
// convert NIP-02 to array of pubkey
|
||||
export function nip02ToArray(tags: any) {
|
||||
const arr = [];
|
||||
|
||||
Reference in New Issue
Block a user