protected function heading($element)
{
$type = (int) substr($element->tagName, 1);
switch ($type) {
case 1:
$text = trim($this->parse_children($element));
$text .= "\n" . str_repeat("=", strlen($text));
return $text;
case 2:
$text = trim($this->parse_children($element));
$text .= "\n" . str_repeat("-", strlen($text));
return $text;
default:
return str_repeat('#', $type) . ' ' . $this->parse_children($element);
}
}