Skip to content

(Auto)linking for non-http(s) and non-www URLs #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
shaedrich opened this issue Feb 17, 2025 · 0 comments
Open

(Auto)linking for non-http(s) and non-www URLs #61

shaedrich opened this issue Feb 17, 2025 · 0 comments

Comments

@shaedrich
Copy link

shaedrich commented Feb 17, 2025

Your autolinking feature is awesome. But it would be even better if there could be either

  • an annotation
  • a config option
```shell
composer install torchlight-api/torchlight [tl! autolink]
```

to allow for non-http(s) and non-www URLs to be linked which either

  • just have different scheme/protocol (could be turned on by either an object whose value is true or an array list)
  • requires mapping (which could be implemented with either a function or regexp replacements)
<?php

return [
    'links' => [
        // either
        'protocols' => [ 'https', 'ftp', 'vscode' ],
        // or
        'protocols' => [
            'https' => true,
            'http' => false,
            // or
            'ftp' => [ '/^ftp:\/\/(?<username>(.*)(?=:)):(?<password>(.*)(?=@))@(.*)$/', 'ftp://$url?username=$username&password=$password' ],
            // or
            'vscode' => fn (string $url) => explode('?', $url)[0],
        ],
    ],
];
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

No branches or pull requests

1 participant