html_to_markdown = new HtmlConverter(); } /** * Converts the given BBCode to markdown. * BBCode tags that does not have a markdown aequivalent are outputed as HTML tags. * * @param $bbcode string The Markdown that should be converted. * * @return string The markdown version of the text. */ public function convert(string $bbcode): string { //Convert BBCode to html $xml = TextFormatter::parse($bbcode); $html = TextFormatter::render($xml); //Now convert the HTML to markdown return $this->html_to_markdown->convert($html); } }