Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


added support for the tel: url-scheme #127

wants to merge 1 commit into from

3 participants


This little patch adds support for the tel: url-scheme


Nice idea. I'm not too sure about the syntax though. If you take the email syntax, you can write it directly without a mailto: prefix (which is what most people do). I'm not sure if this can be done reliably for a phone number though (various places in the world have various formatting, and this might look too much like a tag).


Could this not be a one-line diff which adds |tel to the line

$text = preg_replace_callback('{<((https?|ftp|dict):[^\'">\s]+)>}i', 



Eh, that's strange. This pull request should be marked merged, but Github doesn't seem to acknowledge it. It probably has something to do with cherry-picking the commit.

I'm going to close this because it was merged.

@pjt33 The difference with the tel: scheme compared to http and others is that we remove the "tel:" prefix in the link's text content.

@michelf michelf closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 12, 2013
  1. @derflocki
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 1 deletion.
  1. +8 −1 markdown.php
9 markdown.php
@@ -1447,9 +1447,16 @@ function doAutoLinks($text) {
array(&$this, '_doAutoLinks_email_callback'), $text);
+ $text = preg_replace_callback('{<(tel:([^\'">\s]+))>}i',array(&$this, '_doAutoLinks_tel_callback'), $text);
return $text;
+ function _doAutoLinks_tel_callback($matches) {
+ $url = $this->encodeAttribute($matches[1]);
+ $tel = $this->encodeAttribute($matches[2]);
+ $link = "<a href=\"$url\">$tel</a>";
+ return $this->hashPart($link);
+ }
function _doAutoLinks_url_callback($matches) {
$url = $this->encodeAttribute($matches[1]);
$link = "<a href=\"$url\">$url</a>";
@@ -1740,4 +1747,4 @@ function _unhash_callback($matches) {
software, even if advised of the possibility of such damage.
Something went wrong with that request. Please try again.