Skip to content

MARISSA MOLEJON | OCT2025-1 | Module-Legacy-Code | Sprint 1 | fix hashtag link - #3

Open
marissamolejon wants to merge 1 commit into
mainfrom
fix/hashtag-link
Open

MARISSA MOLEJON | OCT2025-1 | Module-Legacy-Code | Sprint 1 | fix hashtag link#3
marissamolejon wants to merge 1 commit into
mainfrom
fix/hashtag-link

Conversation

@marissamolejon

Copy link
Copy Markdown
Owner

Summary

clicking a #hashtag link inside a bloom led to an empty
page when the hashtag wasn't the last word in the bloom's text.

Fix

Replaced [^#]+ with \w+ (word characters: letters, digits,
underscore) in the regex, so matching stops naturally at the first
space or punctuation mark rather than consuming the rest of the
sentence:

text.replace(/\B#\w+/g, (match) => `<a href="proxy.php?url=https%3A%2F%2Fgithub.com%2Fhashtag%2F%3Cspan+class%3D"pl-s1">${match.slice(1)}">${match}</a>`)

Testing

  • Verified the corrected regex in isolation against both of Swiz's
    reported blooms, plus an additional case with underscores, digits,
    and multiple hashtags in one string — all produced correct links.
  • Verified live in the browser: clicking #SwizBiz in "Let's get
    some #SwizBiz love!!"
    now correctly navigates to
    /#/hashtag/SwizBiz and shows both of Swiz's blooms, matching the
    issue's expected behavior.

Scope

Single file changed: front-end/components/bloom.mjs. No backend or
data changes.

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.

1 participant