public function outputLink($cap, $link) { $href = Utils::escape($link['href']); $title = $link['title'] ? Utils::escape($link['title']) : null; return $cap[0][0] !== '!' ? $this->renderer->link($href, $title, $this->output($cap[1])) : $this->renderer->image($href, $title, Utils::escape($cap[1])); }
Marked::$inline['_href'] = new RegExp('\\s*<?([\\s\\S]*?)>?(?:\\s+[\'"]([\\s\\S]*?)[\'"])?\\s*'); Marked::$inline['link'] = Utils::replace(Marked::$inline['link'], array(array('inside', Marked::$inline['_inside']), array('href', Marked::$inline['_href']))); Marked::$inline['reflink'] = Utils::replace(Marked::$inline['reflink'], array(array('inside', Marked::$inline['_inside']))); /** * Normal Inline Grammar */ Marked::$inline['normal'] = Marked::$inline; /** * Pedantic Inline Grammar */ Marked::$inline['pedantic'] = Marked::$inline['normal']; Marked::$inline['pedantic']['strong'] = new RegExp('^__(?=\\S)([\\s\\S]*?\\S)__(?!_)|^\\*\\*(?=\\S)([\\s\\S]*?\\S)\\*\\*(?!\\*)'); Marked::$inline['pedantic']['em'] = new RegExp('^_(?=\\S)([\\s\\S]*?\\S)_(?!_)|^\\*(?=\\S)([\\s\\S]*?\\S)\\*(?!\\*)'); /** * GFM Inline Grammar */ Marked::$inline['gfm'] = Marked::$inline['normal']; Marked::$inline['gfm']['escape'] = Utils::replace(Marked::$inline['escape'], array(array('])', '~|])'))); Marked::$inline['gfm']['url'] = new RegExp('^(https?:\\/\\/[^\\s<]+[^<.,:;"\')\\]\\s])'); Marked::$inline['gfm']['del'] = new RegExp('^~~(?=\\S)([\\s\\S]*?\\S)~~'); Marked::$inline['gfm']['text'] = Utils::replace(Marked::$inline['text'], array(array(']|', '~]|'), array('|', '|https?:\\/\\/|'))); /** * GFM + Line Breaks Inline Grammar */ Marked::$inline['breaks'] = Marked::$inline['gfm']; Marked::$inline['breaks']['br'] = Utils::replace(Marked::$inline['br'], array(array('{2,}', '*'))); Marked::$inline['breaks']['text'] = Utils::replace(Marked::$inline['gfm']['text'], array(array('{2,}', '*'))); /** * Options */ Marked::$defaults = array('gfm' => true, 'tables' => true, 'breaks' => false, 'pedantic' => false, 'sanitize' => false, 'smartLists' => false, 'highlight' => null, 'langPrefix' => 'lang-', 'smartypants' => false, 'headerPrefix' => '', 'renderer' => new Renderer(), 'xhtml' => false);