/** * Convert to BBCode * * Converts an individual node into a #text node containing a string of its BBCode equivalent. * * Example: An <h3> node with text content of 'Title' becomes a text node with content of '### Title' * * @param ElementInterface $element * * @return string The converted HTML as BBCode */ protected function convertToBBCode(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); }