File tree 1 file changed +15
-1
lines changed
1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,11 @@ public static function defaultTransform(string $text): string {
65
65
public bool $ no_markup = false ;
66
66
public bool $ no_entities = false ;
67
67
68
+ /**
69
+ * Change to `true` to enable autolinking without the need for angle brackets
70
+ * @var boolean
71
+ */
72
+ public bool $ autolinks = false ;
68
73
69
74
/**
70
75
* Change to `true` to enable line breaks on \n without two trailling spaces
@@ -1606,7 +1611,16 @@ protected function encodeAmpsAndAngles($text) {
1606
1611
* @return string
1607
1612
*/
1608
1613
protected function doAutoLinks ($ text ) {
1609
- $ text = preg_replace_callback ('{<((https?|ftp|dict|tel):[^ \'">\s]+)>}i ' ,
1614
+ if ($ this ->autolinks )
1615
+ {
1616
+ $ regex = '{((https?|ftp|dict|tel):[^ \'">\s]+)}i ' ;
1617
+ }
1618
+ else
1619
+ {
1620
+ $ regex = '{<((https?|ftp|dict|tel):[^ \'">\s]+)>}i ' ;
1621
+ }
1622
+
1623
+ $ text = preg_replace_callback ($ regex ,
1610
1624
array ($ this , '_doAutoLinks_url_callback ' ), $ text );
1611
1625
1612
1626
// Email addresses: <[email protected] >
You can’t perform that action at this time.
0 commit comments