Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hashtags: Protect HTML tags from being broken #261

Merged
merged 1 commit into from
Jan 27, 2023

Conversation

akirk
Copy link
Member

@akirk akirk commented Jan 27, 2023

If your post has HTML that contains something that resembles a hashtag, the ActivityPub plugin currently breaks that tag by replacing new HTML tags into the other tag.

Specifically, this HTML:

<span style="color: #ccc">Only friends</span>

will be transformed to this:

<span style="color: <a rel="tag" class="u-tag u-category" href="https://alex.kirk.at/tag/ccc/">#ccc</a>;&#8221;>Only friends</span>

which visually appears like this:

Screenshot 2023-01-27 at 12 07 34

This PR adds protection of the tag before the replacing operation happens and then replaces them back in, resulting in unmodified tags inside HTML:

Screenshot 2023-01-27 at 12 09 23

@akirk akirk requested a review from pfefferle January 27, 2023 11:19
@akirk akirk self-assigned this Jan 27, 2023
Copy link
Member

@pfefferle pfefferle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thanks a lot!

@pfefferle pfefferle merged commit 934ef86 into master Jan 27, 2023
@pfefferle pfefferle deleted the hashtags-protect-tags branch January 27, 2023 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants