PHP Markdown \ n问题 [英] PHP Markdown \n Question

查看:251
本文介绍了PHP Markdown \ n问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 http://michelf.com/projects/php-markdown/我的markdown库,我的问题是,如果我编辑并删除\n\n功能会成功

I'm using http://michelf.com/projects/php-markdown/ for my markdown library and my question is that if i edit and remove the \n\n functionality would this work

因为我拥有的用户很可能不允许运行JavaScript,因此我不能指望动态生成预览,因此他们将使用\n而不是\n\n

Because the users that i have, are quite probably not allowed to run JavaScript therefore i cant count on the preview to be generated dynamically therefore they will make allot of mistakes using \n instead of \n\n

所以问题是:库是否必须使用\n\n进行正则表达式操作?

So the question is: is it essential for the library to use the \n\n for the reg ex manipulation?

推荐答案

在进行了一些研究并查看了降价转换后,我注意到该方法可以通过以下方式完成:

After doing some research and looking at the markdown convertion, ive noticed that it can be done in such way:

例如,我们有文字:

asdf
asdf
asdf

asdf
asdf
asdf

纯文本标记"中的输出为:

The output of this in Pure text Markup will be:

<p>asdf
asdf
asdf</p>

<p>
asdf
asdf
asdf</p>

因此,替换\n只能在<p>标记内完成

So to replace the \n must only be done inside the <p> tags

这篇关于PHP Markdown \ n问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆