Skip to content

Conversation

@nelsonblaha
Copy link

Summary

This PR enhances the markdown parser to automatically detect and convert plain URLs into clickable links that open in new tabs.

Changes

  • Added URL pattern detection for http://, https://, and www. URLs in parseMarkdownSpans.ts
  • Created splitTextWithUrls() helper function to identify URLs in plain text
  • URLs starting with www. are automatically prefixed with https://
  • Added rel="noopener noreferrer" to Link component for improved security
  • URLs in markdown links [text](url) continue to work as before
  • URLs in code blocks remain as plain text (not clickable)

Motivation

Users frequently share URLs in conversations, and having to manually format them as markdown links ([text](url)) is inconvenient. This change makes plain URLs automatically clickable, improving the user experience.

Testing

  • URLs like https://example.com, http://example.com, and www.example.com are now automatically detected and clickable
  • Multiple URLs in the same message are all detected
  • URLs with paths and query parameters work correctly
  • Existing markdown links continue to function as expected
  • URLs within code blocks remain as plain text

Example

Before: Check out https://example.com for more info (not clickable)
After: Check out https://example.com for more info (clickable, opens in new tab)


Generated with Claude Code
via Happy

nelsonblaha and others added 6 commits December 1, 2025 20:20
When using happy-web to start a new session, clicking the machine name
to change it and then selecting a different machine would cause the
selection to revert back to the original machine.

Root cause: Module-level callback pattern had race conditions in web
environments where router.back() could complete before state updates
propagated.

Fix: Pass selectedMachineId explicitly via route params when navigating
back from machine picker. This ensures the selection is guaranteed to
be available when the component mounts.

Also exclude test files from metro bundler to prevent vitest from being
bundled into the web app.

Tests: Added machineSelection.spec.ts with 9 tests covering the bug
reproduction, callback race conditions, and route param solution.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This workflow runs tests and auto-deploys happy-cli to the nelnet
production server.

Features:
- Tests run on GitHub-hosted runners (typecheck, build, test)
- Deployment runs on self-hosted runner (nelnet server)
- Supports main, master, and fix/pass-tests branches
- Dynamically deploys the branch that triggered the workflow
- Restarts happy daemon with health check verification

Deployment steps:
1. Pull latest code to /home/ben/src/happy/happy-cli
2. Install dependencies and build
3. Restart happy daemon
4. Verify daemon health on port 3005

🤖 Generated with [Claude Code](https://claude.com/claude-code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
Only happy-private should use nelnet-ci for automated deployments.
The public fork (nelsonblaha/happy) is only for upstream contributions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
Per software development standards, bug documentation should not be
committed to source code repositories. Use git commit messages,
issue trackers, or external documentation instead.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This update enhances the markdown parser to automatically detect and convert plain URLs into clickable links that open in new tabs.

Changes:
- Added URL pattern detection for http://, https://, and www. URLs in parseMarkdownSpans.ts
- Created splitTextWithUrls() helper function to identify URLs in plain text
- URLs starting with www. are automatically prefixed with https://
- Added rel="noopener noreferrer" to Link component for improved security
- URLs in markdown links [text](url) continue to work as before
- URLs in code blocks remain as plain text (not clickable)

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This adds 33 tests covering:
- Basic URL detection (https://, http://, www.)
- Multiple URLs in one line
- URLs with paths, query parameters, and fragments
- Interaction with existing markdown formatting
- Text preservation around URLs
- Edge cases (ports, subdomains, hyphens, etc.)
- Real-world examples (GitHub, docs, APIs, Yahoo)
- Backward compatibility with existing markdown functionality

All tests pass, confirming the URL detection feature works correctly
without breaking existing markdown parsing behavior.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
@nelsonblaha
Copy link
Author

Tests Added ✅

I've added comprehensive test coverage for the URL detection feature:

  • 33 tests covering all aspects of URL detection
  • Tests for https://, http://, and www. URLs
  • Multiple URLs in one message
  • URLs with paths, query parameters, and fragments
  • Interaction with existing markdown formatting
  • Edge cases (ports, subdomains, special characters)
  • Real-world examples (GitHub, documentation, APIs)
  • Backward compatibility tests for existing markdown features

All tests pass

The tests confirm that the URL detection feature works correctly without breaking any existing markdown parsing behavior.

@nelsonblaha
Copy link
Author

Issue Search Results

I searched through the upstream repository's issues and didn't find any existing feature requests for clickable URLs in the transcript. This appears to be a proactive quality-of-life improvement rather than addressing a specific reported issue.

Related observations:

  • No issues about markdown formatting or URL handling in messages
  • No feature requests for clickable links in the chat interface
  • This is a common UX pattern in chat/messaging apps

The feature enhances usability by automatically making URLs clickable without requiring users to manually format them as markdown links [text](url).

@nelsonblaha
Copy link
Author

Related Pull Requests

I searched for similar PRs and found:

PR #232 - Markdown Enhancements (OPEN)

  • Title: "Add Markdown Table Rendering, Code Block Copy Button, and Mermaid Diagram Support"
  • Files modified: Also touches MarkdownView.tsx and markdown parsing files
  • Potential conflict: Both PRs modify MarkdownView.tsx, but they appear to be complementary features
  • Status: Currently open

PR #82 - Markdown Copy (MERGED)

  • Title: "Resolve markdown copy issues by adding full-text selection and copy functionality"
  • Files modified: Also modified MarkdownView.tsx
  • Impact: Already merged, no conflicts with our changes

Analysis:

Our changes are focused and isolated to URL detection logic, making them compatible with other markdown improvements.

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