Skip to content

Commit

Permalink
Fix mentions being formatted with Markdown
Browse files Browse the repository at this point in the history
Prevents usernames with underscores being formatted with underline.

Signed-off-by: Plastikmensch <[email protected]>
  • Loading branch information
Plastikmensch committed Oct 6, 2023
1 parent ebd2017 commit 41bc94a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/lib/advanced_text_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ def rewrite
private

def format_markdown(html)
html = markdown_formatter.render(html)
# Force escape usernames in mentions before formatting
html = markdown_formatter.render(html.gsub(Account::MENTION_RE) { |re| re.gsub('_', '\\_') })
html.delete("\r").delete("\n")
end

Expand Down

0 comments on commit 41bc94a

Please sign in to comment.