Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jun 26, 2025

This PR adds Stack Overflow question link components to complement the existing GitHub issue link functionality, allowing users to embed rich previews of Stack Overflow questions in their applications.

New Components

  • StackOverflowLink: Client component with useEffect data fetching
  • StackOverflowLinkBase: Base component that renders with provided data
  • StackOverflowLinkRsc: RSC component for server-side rendering

Features

  • ✅ URL parser for Stack Overflow question URLs (supports various formats with/without titles and query params)
  • ✅ Stack Exchange API v2.3 integration for fetching question metadata
  • ✅ Custom Stack Overflow SVG icon with proper branding colors
  • ✅ Both inline and block display variants
  • ✅ Rich question previews showing:
    • Question title and ID
    • Score, answer count, and view count
    • Visual indicator for answered questions (✓)
    • Question tags with proper styling
  • ✅ Consistent styling with existing components (light/dark theme support)
  • ✅ Comprehensive error handling for 404s, rate limits, etc.

Usage

import { StackOverflowLink } from 'react-github-permalink';
import "react-github-permalink/dist/github-permalink.css";

// Block variant (default)
<StackOverflowLink questionLink='https://stackoverflow.com/questions/64572466/how-to-use-react-context-in-typescript' />

// Inline variant
<StackOverflowLink questionLink='https://stackoverflow.com/questions/64572466' variant="inline" />

Implementation Details

  • Follows the same architectural pattern as GitHub issue links for consistency
  • Added comprehensive URL parser tests (5 new test cases)
  • Updated configuration types to include getStackOverflowFn
  • Added proper TypeScript exports for all variants
  • Updated documentation with usage examples and configuration details
  • All existing tests continue to pass (11/11)

The implementation maintains the existing API design patterns while extending functionality to support Stack Overflow content, making it easy for users to reference both GitHub issues and Stack Overflow questions in their applications.

Fixes #26.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.stackexchange.com
    • Triggering command: curl -s REDACTED (dns block)
  • storybook.js.org
    • Triggering command: node /home/REDACTED/work/react-github-permalink/react-github-permalink/node_modules/.bin/storybook dev -p 6006 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Add Stack Overflow links Add Stack Overflow link components Jun 26, 2025
Copilot AI requested a review from dwjohnston June 26, 2025 07:33
Copilot finished work on behalf of dwjohnston June 26, 2025 07:33
})
});

describe(parseStackOverflowLink, () => {
Copy link
Owner

Choose a reason for hiding this comment

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

👍

@changeset-bot
Copy link

changeset-bot bot commented Jun 27, 2025

🦋 Changeset detected

Latest commit: 8306d5e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
react-github-permalink Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link

netlify bot commented Jun 27, 2025

Deploy Preview for react-github-permalink ready!

Name Link
🔨 Latest commit 8306d5e
🔍 Latest deploy log https://app.netlify.com/projects/react-github-permalink/deploys/685e3989cef74b0008c84436
😎 Deploy Preview https://deploy-preview-60--react-github-permalink.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@dwjohnston dwjohnston marked this pull request as ready for review June 27, 2025 06:25
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.

Add Stack Overflow links

2 participants