3 * @copyright Copyright (c) 2014 Carsten Brandt
4 * @license https://github.com/cebe/markdown/blob/master/LICENSE
5 * @link https://github.com/cebe/markdown#readme
8 namespace cebe\markdown\inline;
11 * Adds inline code elements
16 * Parses an inline code span `` ` ``.
19 protected function parseInlineCode($text)
21 if (preg_match('/^(``+)\s(.+?)\s\1/s', $text, $matches)) { // code with enclosed backtick
29 } elseif (preg_match('/^`(.+?)`/s', $text, $matches)) {
38 return [['text', $text[0]], 1];
41 protected function renderInlineCode($block)
43 return '<code>' . htmlspecialchars($block[1], ENT_NOQUOTES | ENT_SUBSTITUTE, 'UTF-8') . '</code>';