socket.on('message', function(msg, timestamp) { // Parse msg for markdown syntax msg = marked(msg); // If msg is a youtube video, broadcast without xss filtering if (msg.indexOf('src="http://www.youtube.com/embed') === 11 && msg.length < 130) { broadcast(socket, 'message', msg, socket.nick, timestamp); return; } // Otherwise filter for xss and then broadcast msg = xss.process(msg); broadcast(socket, 'message', msg, socket.nick, timestamp); });
rawMarkdown () { // parse chats for markdown syntax return { __html: marked(this.props.message.msg, {sanitize: true}) }; }