Skip to content

feat: add Medium deep link support#87

Open
kashyap-savaliya wants to merge 1 commit into
mdsaban:mainfrom
kashyap-savaliya:feat/medium-deeplink
Open

feat: add Medium deep link support#87
kashyap-savaliya wants to merge 1 commit into
mdsaban:mainfrom
kashyap-savaliya:feat/medium-deeplink

Conversation

@kashyap-savaliya

@kashyap-savaliya kashyap-savaliya commented Feb 8, 2026

Copy link
Copy Markdown

🆕 What's Added

This PR introduces Medium deep-link support.
It enables opening Medium articles and profiles directly in the native Medium app when installed, with safe fallback to the web.

🔗 Supported URL patterns

  • https://medium.com/@username - User profiles
  • https://medium.com/@username/article-slug - User articles
  • https://medium.com/publication-name/article-slug - Publication articles
  • https://username.medium.com/article-slug - Custom domain articles

🛠 Implementation details

  • Introduces a new mediumHandler following the existing handler pattern
  • Generates platform-specific deep links:
    • iOS: medium:// scheme with path preservation
    • Android: intent:// with package com.medium.reader and fallback URL
  • Handles multiple Medium URL formats (user profiles, publications, custom domains)
  • Includes error handling for URL parsing edge cases
  • Plugged the handler into the handler registry
  • Added medium to Platform type union

🧪 Testing

  • Tested locally using the demo app (pnpm dev → localhost:5173)
  • Verified URL pattern matching for all supported formats
  • Verified deep link generation for iOS and Android
  • No linting errors

📝 Files Changed

  • packages/core/src/platforms/medium.ts - New handler implementation
  • packages/core/src/types.ts - Added 'medium' to Platform type
  • packages/core/src/platforms/index.ts - Exported mediumHandler
  • packages/core/src/index.ts - Registered mediumHandler in handlers array

🙌 Thank You @mdsaban

Happy to contribute Medium platform support to expand the library's coverage. Open to feedback and improvements!

Summary by CodeRabbit

New Features

  • Added Medium platform support for generating platform-specific deep links to user profiles, publications, and custom subdomains on iOS and Android.

@coderabbitai

coderabbitai Bot commented Feb 8, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR adds Medium platform support to the deep link generation system by introducing a new platform handler that detects Medium URLs and converts them into platform-specific deep links for iOS and Android devices.

Changes

Cohort / File(s) Summary
Medium Platform Handler
packages/core/src/platforms/medium.ts
New handler with regex-based URL matching for Medium user profiles, publications, and custom subdomains. Builds iOS deep links as medium://<path> and Android intent URLs with browser fallback.
Handler Integration
packages/core/src/index.ts, packages/core/src/platforms/index.ts
Imported and registered mediumHandler in the handlers array and platform exports.
Type System
packages/core/src/types.ts
Extended Platform union type to include 'medium' as a valid platform identifier.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested reviewers

  • mdsaban

Poem

🐰 A Medium tale, now within our reach,
Deep links built for iOS and Android's beach,
With regex patterns matching profiles so bright,
Intent URLs guide users to content just right! 📱✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately describes the main change: adding Medium platform support with deep link functionality, which aligns perfectly with the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@packages/core/src/platforms/medium.ts`:
- Line 50: The iosDeepLink constant currently builds a custom-scheme URL
(`iosDeepLink = \`medium://${path}\``) which is unsupported by Medium; change
the logic that sets iosDeepLink so it uses the canonical HTTPS webUrl (the
Universal Link) instead of a medium:// scheme, and ensure the function that
returns platform-specific links (referencing iosDeepLink and webUrl) returns
either the webUrl (or null for explicitly unsupported platforms) rather than a
custom-scheme deep link; also remove any ad-hoc leading-slash stripping for iOS
because Universal Links use the standard web path.
🧹 Nitpick comments (1)
packages/core/src/platforms/medium.ts (1)

36-36: match parameter is unused in build.

The build method re-parses the URL from webUrl instead of using the already-captured groups in match. While functionally correct, using match groups directly would be more consistent with the DeepLinkHandler interface contract and avoid redundant parsing.

Comment thread packages/core/src/platforms/medium.ts
@kashyap-savaliya

Copy link
Copy Markdown
Author

@mdsaban Could you please review my PR

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