/** * Process the fenced code blocks * * @param array $matches Results form the `transform()` function * @return string */ protected function _callback($matches) { $language = $matches[2]; $codeblock = Helper::escapeCodeContent($matches[3]); $codeblock = preg_replace_callback('/^\\n+/', array($this, '_newlines'), $codeblock); $attributes = array(); if (!empty($language)) { $attributes['language'] = $language; } $codeblock = Kernel::get('OutputFormatBag')->buildTag('preformatted', $codeblock, $attributes); return "\n\n" . parent::hashBlock($codeblock) . "\n\n"; }
/** * Create a code span markup for $code. Called from handleSpanToken. * * @param string $code * @return string */ public function span($code) { $codeblock = Kernel::get('OutputFormatBag')->buildTag('code', Helper::escapeCodeContent(trim($code))); return parent::hashPart($codeblock); }