bookwyrm
bookwyrm copied to clipboard
Comments strip # symbol from keywords when posted
Describe the bug When I do an "update progress" entry on the platform, hashtags are getting stripped from my comment, so that it appears without the hashtag both on the bookwyrm profile and in federated feeds.
To Reproduce
- Have a book in progress.
- Select "Update progress"
- Write a comment in the comments field, with at least one keyword denoted by a hashtag symbol #. Ensure that "post to feed" is checked. I was posting with spoilers turned on, though I am not sure if this impacts the bugs appearance.
- When you view the comment directly on the local profile, or when any users that follow you see the comment in their federated feeds, the comment will appear without the hashtag on the keyword. As a result, you will not be able to find the comment in keyword searches.
Expected behavior Keywords should appear in the comment as initially entered, rather than having the hashtag symbol stripped from them.
Screenshots
Note #DraculaDaily used in the original comment entry. It appears as DraculaDaily without the hashtag in the final post
Instance https://bookrastinating.com/
Desktop (please complete the following information): Initial entry was performed with the following setup. - OS: Windows 10 - Browser Chrome - Version 101.0.4951.67
Thank you! I suspect what's happening here is that markdown converts the #
into an h1
tag, and then the html sanitizer removes the h1
tag because it's not on the html allow list. The next step will be checking if the markdown library can please ignore certain things
The fix I wrote will prevent the symbol from being stripped from the post, but the hashtag itself will still not work pending #1081 (both locally and on Mastodon and other software I think, unfortunately)
This should be fixed with the initial hashtag support from #2524