Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Escape IRC messages as plaintext (i.e. no Markdown formatting) in Telegram #142
IRC messages sent to Telegram always render as plaintext (i.e. no Markdown formatting rules applied)
When hyperlinks including underscore characters are sent across the bridge, Telegram has suddenly started rendering this as italics:
Obviously URLs should render as plain-text only.
This needs investigation. We need to do some message pre-processing on received IRC messages before sending them over to IRC. I think this is an unintended side effect of #134 when we changed
URLs successfully appear as written when sent across bridge
I'm always hesitant to add more pre-message processing as this adds more overhead to TeleIRC before messages are sent across the bridge.
At the moment, it seems to me that we have several courses of actions with this issue:
Course 1 involves parsing every IRC message for a contained string (Does JS have this natively?), and reverting only the web link back to plaintext. This is most likely possible, but would nonetheless add some more overhead to each message. If this is something we are willing to do, then I don't have any issues going forth with this.
Course 2 simply reverts all the markdown, getting rid of the IRC bolding. I've gotten quite fond of the IRC bolding Telegram side, as it makes it easy to see when folks are messaging from IRC. This route would need to weigh the pros/cons of having correct links versus having the bold formatting. This is the easiest option.
The line that introduces the markdown to bold the username is inside of IrcMessageHandler.js:
We're only using markdown to bold the username, and nowhere else (to my knowledge). Could we just escape the user's message so any markdown get escaped? Something like:
Given Node's lackluster standard library, I doubt such function exists without pulling a dependency or rolling our own.