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

Comment search: highlight search terms #1373

Open
pushcx opened this issue Nov 10, 2024 · 0 comments
Open

Comment search: highlight search terms #1373

pushcx opened this issue Nov 10, 2024 · 0 comments

Comments

@pushcx
Copy link
Member

pushcx commented Nov 10, 2024

When someone searches for terms in a comment, those terms could be highlighted with the mark tag in the comment text.

Mockup:

2024-11-10_13-25

Comment text is stored in comments.comment as the user wrote, using markdown, and rendered to html in comments.markeddown_comment. This is so we don't incur that render cost on every view of a comment, but it means this feature will need to operate on the HTML rather than the markdown. (I suppose it's possible as part of adding Solid Cache in #1366 that we could move this functionality out of the database and into a fragment cache with a long expiry, say 365 days. Though we'd want to add significant testing that changes to our markdown code or commonmark don't lead to comment rendering changing meaningfully over time!)

A corner case: MariaDB's full-text indexes for search ignore punctuation, whether used as part of a sentence or as markdown. So you can search for a quoted phrase like "sometimes correctly" to find this same comment where it is rendered in HTML as correctly.</p></blockquote><p>Sometimes.

2024-11-10_13-35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant