mirror of
https://github.com/typecho/typecho.git
synced 2025-03-19 01:19:40 +01:00
fix #435
This commit is contained in:
parent
59bc86ff46
commit
2903f6a191
@ -22,9 +22,21 @@ class Markdown
|
||||
|
||||
if (empty($parser)) {
|
||||
$parser = new HyperDown();
|
||||
$parser->hook('afterParseCode', array('Markdown', 'transerCodeClass'));
|
||||
}
|
||||
|
||||
return $parser->makeHtml($text);
|
||||
}
|
||||
|
||||
/**
|
||||
* transerCodeClass
|
||||
*
|
||||
* @param string $html
|
||||
* @return string
|
||||
*/
|
||||
public static function transerCodeClass($html)
|
||||
{
|
||||
return preg_replace("/<code class=\"([_a-z0-9-]+)\">/i", "<code class=\"lang-\\1\">", $html);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user