Normalize social inputs and canonicalize profile URL generation#962
Open
xtyledan wants to merge 1 commit intorahuldkjain:mainfrom
Open
Normalize social inputs and canonicalize profile URL generation#962xtyledan wants to merge 1 commit intorahuldkjain:mainfrom
xtyledan wants to merge 1 commit intorahuldkjain:mainfrom
Conversation
Normalize social inputs before URL generation Add canonical URL builder for social links Correct Medium, YouTube, and HackerEarth profile URL formats Use normalized handles for GitHub/Twitter badge and stats parameters Add regression tests covering username, @handle, and pasted profile URL inputs Verification: npx vitest run src/lib/markdown-generator.test.ts → 3/3 tests passed npm run type-check passed Fixes malformed links when users provide usernames or full profile URLs in social fields.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Normalize social inputs before URL generation
Add canonical URL builder for social links
Correct Medium, YouTube, and HackerEarth profile URL formats
Use normalized handles for GitHub/Twitter badge and stats parameters
Add regression tests covering username, @handle, and pasted profile URL inputs
Verification:
npx vitest run src/lib/markdown-generator.test.ts → 3/3 tests passed
npm run type-check passed
Fixes malformed links when users provide usernames or full profile URLs in social fields.
🔄 Pull Request
📋 Type of Change (check all applicable)
📖 Description
Normalizes social profile inputs before generating links in the README output. Ensures usernames, @Handles, and full profile URLs produce valid canonical profile links for supported platforms. Fixes malformed URLs previously generated when inputs were not in the expected format and adds regression tests to guarantee correct behavior across the supported input patterns.
What changed?
src/lib/markdown-generator.ts.src/lib/markdown-generator.test.ts.Why was this change made?
Users frequently enter social handles in inconsistent formats such as plain usernames,
@handles, or full profile URLs. The generator previously assumed a single format, which caused malformed profile links to be generated.How does this change help users?
All social inputs are normalized before URL generation. This ensures valid canonical URLs are produced regardless of whether users enter usernames,
@handles, or pasted profile URLs.🔗 Related Issues
🧪 Testing & Quality Assurance
Testing Done (check all applicable)
Test Instructions
username,@handle, and full profile URL.Expected Behavior
Generated README links should always resolve to valid social profile URLs regardless of the input format used.
📸 Screenshots/Recordings
Before
Inputs such as
@usernameor full URLs could generate malformed profile links.After
All supported input formats are normalized and produce valid canonical profile URLs.
📋 Checklist
Code Quality
npm run type-check)npm run lint)npm run format)npm run build)Accessibility
Mobile & Responsive
Browser Compatibility
Documentation
Security & Privacy
🚀 Deployment Notes
📝 Additional Notes
Verification:
npx vitest run src/lib/markdown-generator.test.ts→ 3/3 tests passednpm run type-check→ passedRegression tests confirm usernames,
@handles, and pasted profile URLs generate correct canonical profile links.👀 Reviewers
By submitting this PR, I confirm that: