bookwyrm icon indicating copy to clipboard operation
bookwyrm copied to clipboard

Comments strip # symbol from keywords when posted

Open AdaShovelace opened this issue 2 years ago • 2 comments

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

  1. Have a book in progress.
  2. Select "Update progress"
  3. 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.
  4. 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

Capture Capture2

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

AdaShovelace avatar May 16 '22 01:05 AdaShovelace

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

mouse-reeve avatar May 16 '22 02:05 mouse-reeve

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)

mouse-reeve avatar May 23 '22 22:05 mouse-reeve

This should be fixed with the initial hashtag support from #2524

chdorner avatar Dec 20 '22 22:12 chdorner