hack.chat
hack.chat copied to clipboard
Added name highlighting
Whenever the user's name is mentioned by another person the name is highlighted in red.
You should maybe escape the name for regex before testing, and also add \b before and after the name so it doesn't mark nicknames mid-word. This could also be combined with the new @nick syntax
The pull now escapes the name and checks for @Name if it has a space before it or a start line plus if it ends (The name) with a space or endline.
We shouldn't use LaTeX for coloring the names. Putting a <span>
around it would be best, but I'd need to audit it for XSS.
On a general note, does anyone know how to match text in textContent
and replace it with an HTML element containing the matched text, in a safe way?
I'd imagine the easiest way to do something like that would be to scrub the change before putting it out, removing anything involving javascript (Including hex).
you could also use a <code>
tag afaik :laughing: