From 8605f5ac6b141c526064d13ed96311f2186d6c04 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Mon, 23 May 2022 15:53:17 -0700 Subject: [PATCH] Don't erase hashtag symbol in markdown processing --- bookwyrm/tests/views/test_status.py | 6 ++++++ bookwyrm/views/status.py | 1 + 2 files changed, 7 insertions(+) diff --git a/bookwyrm/tests/views/test_status.py b/bookwyrm/tests/views/test_status.py index 35507157..5f28873e 100644 --- a/bookwyrm/tests/views/test_status.py +++ b/bookwyrm/tests/views/test_status.py @@ -299,6 +299,12 @@ http://www.fish.com/""" result = views.status.to_markdown(text) self.assertEqual(result, '

hi ' "is rad

") + def test_to_markdown_hashtag(self, *_): + """hashtags not titles""" + text = "#cool" + result = views.status.to_markdown(text) + self.assertEqual(result, "

#cool

") + def test_delete_status(self, mock, *_): """marks a status as deleted""" view = views.DeleteStatus.as_view() diff --git a/bookwyrm/views/status.py b/bookwyrm/views/status.py index af15064f..cd13af52 100644 --- a/bookwyrm/views/status.py +++ b/bookwyrm/views/status.py @@ -260,6 +260,7 @@ def _wrapped(text): def to_markdown(content): """catch links and convert to markdown""" content = format_links(content) + content = content.replace("#", "\\#") content = markdown(content) # sanitize resulting html sanitizer = InputHtmlParser()