我正在读
http://github.github.com/github-flavored-markdown/
我想在PHP Markdown中实现“Newline修改”:
最好我想到的是:
$my_html = Markdown($my_text); $my_html = preg_replace("/\n{1}/","<br/>",$my_html);
但这是非常不可预知的.
在您的降价文件中查找行:
function doHardBreaks($text) {
并将其下面的preg模式从:
return preg_replace_callback('/ {2,}\n/',array(&$this,'_doHardBreaks_callback'),$text);
至:
return preg_replace_callback('/ {2,}\n|\n{1}/',$text);
或者你可以扩展markdown类,重新声明’doHardBreaks’功能,并将返回值改为上面的代码
问候,Achmad