Most of mastodon users writes the hashtags in the body text, probably due to their character's limitation.
So, on piefed, if we want to keep their message and make them readable, i think we would have to :
- put detected hashtags in the hashtag field (we should do the same for peertube's video).
- then remove the #, and separate words with camelCase.
And for the coding part, i can't answer it. :)