FixTweetBot icon indicating copy to clipboard operation
FixTweetBot copied to clipboard

fix: escape markdown in link labels only

Open rileychh opened this issue 4 months ago • 2 comments

This PR correctly escapes markdown characters in link labels to prevent Discord from interpreting formatting characters. This is a fixed version of #69, which was closed accidentally and had a bug where it escaped the entire link string (including URLs and markdown syntax) instead of just the labels.

Changes:

  • Added markdown_link() helper function that escapes only the label text
  • Applied escaping in the render() method at link creation time

Example: A username like @_Mochamoru_ in the author label now displays correctly as plain text instead of rendering with italics due to the underscores.

rileychh avatar Oct 13 '25 04:10 rileychh

Discord 2025-10-13 at 15 48 45@2x

Update: Escaping Markdown doesn't work correctly in links in Discord. The same text renders correctly in GitHub. This should not be merged until Discord can correctly render Markdown links.

\_ 
[\_](https://g.co) 
[_italic_](https://g.co) 
[\_escapedItalic_](https://g.co) 
[\_fullyEscapedItalic\_](https://g.co)

_ _ italic _escapedItalic_ _fullyEscapedItalic_

rileychh avatar Oct 13 '25 07:10 rileychh

That's what I thought... I actually had this, but removed it in 5025aa093725da1d8943df6e64e819f9ebc7e197 as it wasn't working as intended, unfortunately.

Kyrela avatar Nov 11 '25 16:11 Kyrela