require_once("library/markdown.php");
require_once("include/html2bbcode.php");
require_once("include/bbcode.php");
-require_once("include/markdownify/markdownify.php");
+require_once("library/html-to-markdown/HTML_To_Markdown.php");
+//require_once("include/markdownify/markdownify.php");
// we don't want to support a bbcode specific markdown interpreter
$s = str_replace("\r","",$s);
// <br/> is invalid. Replace it with the valid expression
- $s = str_replace(array("<br/>", "</p>", "<p>", '<p dir="ltr">'),array("<br />", "<br />", "<br />", "<br />"),$s);
-
- $s = preg_replace('/\@\{(.+?)\; (.+?)\@(.+?)\}/','@[url=https://$3/u/$2]$1[/url]',$s);
+ //$s = str_replace(array("<br/>", "</p>", "<p>", '<p dir="ltr">'),array("<br />", "<br />", "<br />", "<br />"),$s);
// Escaping the hash tags
$s = preg_replace('/\#([^\s\#])/','#$1',$s);
$s = Markdown($s);
+ $s = preg_replace('/\@\{(.+?)\; (.+?)\@(.+?)\}/','@[url=https://$3/u/$2]$1[/url]',$s);
+
$s = str_replace('#','#',$s);
$s = html2bbcode($s);
$Text = bbcode($Text, $preserve_nl, false, 4);
// Libertree doesn't convert a harizontal rule if there isn't a linefeed
- $Text = str_replace(array("<hr />", "<hr>"), array("<br /><hr />", "<br><hr>"), $Text);
+ //$Text = str_replace(array("<hr />", "<hr>"), array("<br /><hr />", "<br><hr>"), $Text);
}
// Now convert HTML to Markdown
- $md = new Markdownify(false, false, false);
- $Text = $md->parseString($Text);
+ $Text = new HTML_To_Markdown($Text);
+
+/*
+ //$md = new Markdownify(false, false, false);
+ //$Text = $md->parseString($Text);
// The Markdownify converter converts underscores '_' in URLs to '\_', which
// messes up the URL. Manually fix these
// Remove all unconverted tags
$Text = strip_tags($Text);
+*/
// Remove any leading or trailing whitespace, as this will mess up
// the Diaspora signature verification and cause the item to disappear