Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 95ee0979e6
Fetching contributors…

Cannot retrieve contributors at this time

file 38 lines (31 sloc) 1.159 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
<?php

//App::import('Vendor', 'MarkupParsers.Markdownify', array('file'=>'markdownify'.DS.'markdownify.php'));
App::import('Vendor', 'MarkupParsers.Markdownify', array('file'=>'markdownify'.DS.'markdownify_extra.php'));

/**
* Tries to use markdownify lib to undo html and parse it back to markdownify
* this is usual if you start blogging in markdownify and need to convert previous posts
* into this new format
*
* 2012-02-08 ms
*/
class MarkdownifyLib {

public $settings = array();

protected $_defaults = array(
'engine' => 'extra', # extra or default
'keepHTML' => MDFY_KEEPHTML,
'bodyWidth' => MDFY_BODYWIDTH,
'linksAfterEachParagraph' => MDFY_LINKS_EACH_PARAGRAPH
);

public function __construct($settings = array()) {
//$linksAfterEachParagraph = MDFY_LINKS_EACH_PARAGRAPH, $bodyWidth = MDFY_BODYWIDTH, $keepHTML = MDFY_KEEPHTML
$this->settings = array_merge($this->_defaults, $settings);
}

public function parseString($html, $options = array()) {
if ($this->settings['engine'] === 'extra') {
$Parser = new Markdownify_Extra();
} else {
$Parser = new Markdownify();
}
return $Parser->parseString($html);
}

}
Something went wrong with that request. Please try again.