Skip to content

Hashtag is not detected when it stands next to a html link without spaces

It comes from this issue pleroma/pleroma#2021

BBCode doesn't wrap text with a p tag as Earmark does, also it replaces \n symbols with <br> tags with no spaces. Linkify can't detect hashtags in some cases.

I used pleroma iex console to call linkify link_map function: Linkify.link_map(text, %{mentions: MapSet.new(), tags: MapSet.new()}, [hashtag: true, hashtag_handler: &Pleroma.Formatter.hashtag_handler/4]

Failed cases (empty tags MapSet):

  • "#cofe<a href=\"https://pleroma.social/\">Source</a>"
  • "#cofe<br><a href=\"https://pleroma.social/\">Source</a>"

Successful cases (tags: #MapSet<[{"#cofe", "cofe"}]>):

  • "#cofe\n<a href=\"https://pleroma.social/\">Source</a>"
  • "#cofe <a href=\"https://pleroma.social/\">Source</a>"
  • "<p>#cofe<br><a href=\"https://pleroma.social/\">Source</a></p>"