Add link to community on hashtags

This commit is contained in:
Rogerio Chaves 2020-05-03 00:24:20 +02:00
parent 60f5a40596
commit f447ee29d4
No known key found for this signature in database
GPG Key ID: E6AF5440509B1D94
1 changed files with 4 additions and 0 deletions

View File

@ -148,6 +148,10 @@ app.use((_req, res, next) => {
/(\s|^)(([a-z-_])*(\.[^\s.]{2,})+)/gm, // Domains without http
`$1<a target="_blank" href="http://$2">$2</a>`
);
result = result.replace(
/(\s|^)#([a-z0-9-]+)/g, // Communities
`$1<a href="/communities/$2">#$2</a>`
);
result = result.replace(/\n/g, "<br />");
return result;
};