Skip to content

Don't parse mentions inside links

Alex Gleason requested to merge alexgleason/linkify:mentions-fix into master

pleroma/pleroma#1656 (closed)

  • The mix.lock changed when I ran mix deps.get so I went ahead and included it
  • Fixed a typo in the readme
  • Refactored Linkify.Parser.parse/2 to enumerate over the types instead of the opts. This lets us enforce the parsing order, so we parse links before mentions.
  • Added a do_parse/4 clause to skip mentions when we're already skipping something else (eg, when inside a link). Although untested, this should also skip mentions inside of <code> and <pre> tags which I believe is the desired behavior.

This code was pretty hard to comprehend at first and it took me several hours to understand it, but I think I got this right. I tested it with an automated test in Pleroma too (locally), and it passed.

Edited by Alex Gleason

Merge request reports

Loading