Get HTML By Markdown

@param string $string

@return string
760005
public function getHtmlByMarkdown($string)
    {
        if (false === class_exists('\Parsedown')) {
            throw new \RuntimeException('Missing Parsedown. Try: composer require "erusev/parsedown" "^1.6.1"');
        }

        $parse = new Parsedown();
        $parse->setBreaksEnabled($this->isParameterParseDownBreaksEnabled());

        return $parse->text($string);
    }
1225779
public function getCurrentFormatting($string)
    {
        $stack = [];
        foreach ($this->getStyleStack($string) as $style) {
            if (preg_match(static::REGEX_FIRST_KEY, $style, $matches)) {
                $key = $matches[0];

                // if this is a valid setting style, add it to the stack
                if (array_key_exists($key, $this->formats)) {
                    $stack[] = ['key' => $key, 'style' => $style];
                } else {
                    // otherwise remove all elements that this turns off from the current stack
                    if ($key === static::STYLE_RESET) {
                        $stack = [];
                    } else {
                        $stack = array_filter($stack, function ($item) use ($key) {
                            return !in_array($key, $this->formats[$item['key']]);
                        });
                    }
                }
            }
        }

        if (count($stack) === 0) {
            return '';
        }

        $items = array_map(function ($item) {
            return $item['style'];
        }, $stack);
        return sprintf(static::ESCAPE . '[%sm', implode(';', $items));
    }
711061
public function markdown($text)
    {
        $text = \Michelf\MarkdownExtra::defaultTransform($text);
        $text = \Michelf\SmartyPantsTypographer::defaultTransform(
            $text,
            "2"
        );
        return $text;
    }
1209446
protected function parse_markdown( $text ) {
		static $markdown = null;

		if ( null === $markdown ) {
			$markdown = new Parsedown();
		}

		return $markdown->text( $text );
	}
261248
public function strip($string, $html = false) {
        return $this->getDecoda()->reset($string)->strip($html);
    }
116761
public function parseString($html)
    {
        /** TODO: custom markdown-extra options, e.g. titles & classes **/
        // <sup id="fnref:..."><a href"#fn..." rel="footnote">...</a></sup>
        // => <fnref target="..." />
        $html = preg_replace('@<sup id="fnref:([^"]+)">\s*<a href="#fn:\1" rel="footnote">\s*\d+\s*</a>\s*</sup>@Us', '<fnref target="$1" />', $html);
        // <div class="footnotes">
        // <hr />
        // <ol>
        //
        // <li id="fn:...">...</li>
        // ...
        //
        // </ol>
        // </div>
        // =>
        // <footnotes>
        //   <fn name="...">...</fn>
        //   ...
        // </footnotes>
        $html = preg_replace_callback('#<div class="footnotes">\s*<hr />\s*<ol>\s*(.+)\s*</ol>\s*</div>#Us', [&$this, '_makeFootnotes'], $html);

        return parent::parseString($html);
    }
627632
protected function clean($string)
    {
        if ($this->format == 'xml') {
            return $string;
        }

        $string = html_entity_decode($string, ENT_QUOTES, 'UTF-8');
        $string = htmlentities($string, ENT_QUOTES, 'UTF-8');

        if (function_exists('mb_convert_encoding')) {
            $string = mb_convert_encoding($string, 'UTF-8');
        } else {
            $string = utf8_decode($string);
        }

        return $string;
    }
1230774
public function makeHTML($text)
    {
        $html = $text;

        if ($this->defaultActions['makeLinks']) {
            $html = $this->makeLinks($html);
        }

        if ($this->defaultActions['convertLineEndings']) {
            $html = $this->convertLineEndings($html);
        }

        return $html;
    }
729442
public static function tags(string $string): string
    {
        $string = str_replace('<', '&lt;', $string);
        $string = str_replace('>', '&gt;', $string);
        return $string;
    }
687368
public static function html($string) {

        if(null === $string) {
            return '';
        }

		if(true === is_numeric($string)) {
    		return $string;
    	}

		if(false === is_string($string)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($string)), E_USER_ERROR);
		}

        return htmlspecialchars($string, static :: $flags, static :: getEncoding());
    }
1181870
public String stripHtmlTags(String string)
    {
        for (int i = 1; i < string.length(); i++)
        {
            if (string.charAt(i) == '<')
            {
                int iEndTag = string.indexOf('>', i);
                if (iEndTag != -1)
                {
                    string = string.substring(0, i) + JAVA_NEW_LINE + string.substring(iEndTag + 1);
                    i--;
                }
            }
        }
        return string;
    }
777474
public function convert($string)
    {
        $css = self::parse($string);
        $data = self::formatCssArray($css);
        $this->data = $data;
        return $data;
    }
112285
public function process($string)
    {
        preg_match_all($this->tagFilter, $string, $matches);

        if (!$matches) {
            return $string;
        }

        foreach ($matches[0] as $i => $m) {
            if (array_key_exists($matches[1][$i], $this->styles)) {
                $string = $this->replaceColors(
                    $string,
                    $matches[1][$i],
                    $matches[2][$i],
                    $this->styles[$matches[1][$i]]
                );
            } elseif (strpos($matches[1][$i], '=')) {
                // Custom format
                $string = $this->replaceColors(
                    $string,
                    $matches[1][$i],
                    $matches[2][$i],
                    ColorStyle::fromString($matches[1][$i])
                );
            }
        }

        return $string;
    }
1335598
private static function __underlineBorder($string)
    {
        $border          = new Border(Border::TYPE_UNDERLINE);
        $borderedElement = new BorderedElement($string, $border);

        return $borderedElement->render();
    }
924671
public function fetchFromString($string ="", $data = [])
    {
        $data = array_merge($this->defaultVariables, $data);

        return $this->environment->createTemplate($string)->render($data);
    }
452045
public static function escapeCss($string)
    {
        if ($string !== '' && !ctype_digit($string))
        {
            $matcher = function($matches)
            {
                $chr = $matches[0];

                if (strlen($chr) !== 1)
                {
                    $chr = static::convertEncoding($chr, 'UTF-16BE', 'UTF-8');
                    $ord = hexdec(bin2hex($chr));
                }
                else $ord = ord($chr);

                return sprintf('\\%X ', $ord);
            };

            $string = preg_replace_callback('/[^a-z0-9]/iSu', $matcher, $string);
        }


        return $string;
    }
210157
public String markdownToHtml(String markdownString) {
		MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
		params.putSingle("md", markdownString);
		return getEntity(invokeGet("utils/md2html", params), String.class);
	}