/**
  * Filter
  * @param string $text markdown
  * @return string $text
  */
 public static function filter($text)
 {
     static $md = null;
     if (!$md) {
         $md = new self();
     }
     $md->no_entities = false;
     $md->no_markup = false;
     return $md->transform($text);
 }
 /**
  * Initialize the parser and return the result of its transform method.
  *
  * This will work fine for derived classes too.
  *
  * @api
  *
  * @param string $text The Markdown text to transform.
  *
  * @return string The transformed string in HTML.
  */
 static function defaultTransform($text)
 {
     static $parser_list;
     // Try to take parser from the static parser list.
     /**
      * @var self $parser
      */
     $parser =& $parser_list[get_called_class()];
     // Create the parser it not already set.
     if (!$parser) {
         $parser = new self();
     }
     // Transform text using parser.
     return $parser->transform($text);
 }
Example #3
0
 public static function parse($string)
 {
     $o = new self();
     return $o->transform($string);
 }
 /**
  * Parse a markdown content
  *
  * @param   string  $content    A raw content to parse
  * @param   null    $options    A set of options to override defaults
  *
  * @return  \MarkdownExtended\Content
  */
 public static function parseString($content, $options = null)
 {
     $mde = new self($options);
     return $mde->transform($content);
 }
Example #5
0
 /**
  * Substitutes variable referenced in the specified text with their values.
  * If an undefined variable is referenced in strict mode, an exception will
  * be thrown. If strict mode is disabled, the reference is left as is instead.
  *
  * @param string $text
  * @param array $variables
  * @param bool $strict Optional. Default is FALSE.
  * @return string
  * @see transform()
  * @see setCallback()
  */
 public static function replace($text, array $variables, $strict = false)
 {
     $replacer = new self($variables, $strict);
     return $replacer->transform($text);
 }
 /**
  *
  * @param  string     string to markdown.
  * @return string
  */
 public static function filter($text)
 {
     static $md = null;
     if (!$md) {
         $md = new self();
     }
     $md->no_entities = true;
     $md->no_markup = true;
     if (isset(self::$getRaw)) {
         return $md->doImages($text);
     }
     $text = $md->transform($text);
     return $text;
 }