Skip to content

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

@shaedrich

Description

@shaedrich

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],
        ],
    ],
];

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions