- $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
- $count = 1;
- $pos = bb_find_open_close($Text, '[', ']', $count);
- while($pos !== false) {
- $start = substr($Text, 0, $pos['start']);
- $subject = substr($Text, $pos['start'], $pos['end'] - $pos['start'] + 1);
- $end = substr($Text, $pos['end'] + 1);
-
- $subject = str_replace('\_', '_', $subject);
- $Text = $start . $subject . $end;
-
- $count++;
- $pos = bb_find_open_close($Text, '[', ']', $count);
- }
+ $converter = new HtmlConverter();
+ $Text = $converter->convert($Text);
+
+ // unmask the special chars back to HTML
+ $Text = str_replace(array('&_lt_;', '&_gt_;', '&_amp_;'), array('<', '>', '&'), $Text);