示例#1
0
 public function code($code, $lang = null, $escaped = null)
 {
     if ($this->options['highlight']) {
         $out = $this->options['highlight']($code, $lang);
         if ($out != null && $out !== $code) {
             $escaped = true;
             $code = $out;
         }
     }
     $class = $lang ? ' class="' . $this->options['langPrefix'] . Markdown::escape($lang, true) . '"' : '';
     $code = $escaped ? $code : Markdown::escape($code, true);
     return "<pre><code{$class}>{$code}\n</code></pre>\n";
 }
示例#2
0
 /**
  * 
  * Escapes HTML in source text.
  * 
  * @param string $text Source text.
  * 
  * @param int $quotes A PHP entities constant, default ENT_COMPAT.
  * 
  * @return string The escaped text.
  * 
  */
 protected function _escape($text, $quotes = ENT_COMPAT)
 {
     return $this->_markdown->escape($text, $quotes);
 }