mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
highlighting links
This commit is contained in:
parent
c8edb8fcc7
commit
1de4fbfcea
1 changed files with 4 additions and 0 deletions
|
@ -100,6 +100,10 @@ export const formatText = (text: string): string =>
|
|||
.replace(/(\/\*[\s\S]*?\*\/)/gim, '<span class="grey">$1</span>')
|
||||
.replace(/([=|-]{5,})/gim, '<hr />')
|
||||
.replace(/:\|--\|/gim, '://')
|
||||
.replace(
|
||||
/(\b(https?|ftp|file):\/\/([-A-Z0-9+&@#%?=~_|!:,.;]*)([-A-Z0-9+&@#%?\/=~_|!:,.;]*)[-A-Z0-9+&@#\/%=~_|])/gi,
|
||||
'<a href="$1" target="blank" rel="nofollow">$1</a>'
|
||||
)
|
||||
.split('\n')
|
||||
.filter(el => el.trim().length)
|
||||
.join('\n');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue