League\HTMLToMarkdown\HtmlConverter::convertToMarkdown PHP Method

convertToMarkdown() protected method

Converts an individual node into a #text node containing a string of its Markdown equivalent. Example: An

node with text content of 'Title' becomes a text node with content of '### Title'

protected convertToMarkdown ( League\HTMLToMarkdown\ElementInterface $element ) : string
$element League\HTMLToMarkdown\ElementInterface
return string The converted HTML as Markdown
    protected function convertToMarkdown(ElementInterface $element)
    {
        $tag = $element->getTagName();
        // Strip nodes named in remove_nodes
        $tags_to_remove = explode(' ', $this->getConfig()->getOption('remove_nodes'));
        if (in_array($tag, $tags_to_remove)) {
            return false;
        }
        $converter = $this->environment->getConverterByTag($tag);
        return $converter->convert($element);
    }