How to treat single newline as real line break in PHP Markdown?

前端 未结 4 1934
说谎
说谎 2021-02-06 01:44

I was reading http://github.github.com/github-flavored-markdown/

I would like to implement that \"Newline modification\" in PHP Markdown:

Best I could think of

4条回答
  •  我寻月下人不归
    2021-02-06 02:21

    I've came up with the following solution, imitating most parts of the gfm newline behavior. It passes all the relevant tests on the page mentioned in the original post. Please note that the code below preprocesses markdown and outputs flavored markdown.

    preg_replace('/(?

提交回复
热议问题