mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
comments highlight
This commit is contained in:
parent
e825db6d63
commit
caeb464bb2
13 changed files with 239 additions and 115 deletions
|
@ -72,11 +72,15 @@ export const formatCommentText = (author, text: string) =>
|
|||
.replace(/(\n{2,})/gi, '\n')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/:\/\//gim, ':|--|')
|
||||
.replace(/(\/\/[^\n]+)/gim, '<span class="grey">$1</span>')
|
||||
.replace(/:\|--\|/gim, '://')
|
||||
.split('\n')
|
||||
.map((el, index) =>
|
||||
index === 0 ? `${author ? `<p><b>${author}</b>: ` : ''}${el}</p>` : `<p>${el}</p>`
|
||||
)
|
||||
.join('');
|
||||
// .replace(/\/\*(\*(?!\/)|[^*])*\*\//igm, '');
|
||||
|
||||
export const getPrettyDate = (date: string): string =>
|
||||
formatDistanceToNow(new Date(date), { locale: ru, includeSeconds: true, addSuffix: true });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue