Faced a problem. The simplest site with text articles, backing to the Phalcon PHP Framework (not the essence), the front on anything, some JS like jQuery and others like it. Need to provide support for Markdown. I use simplemde on the front, I plan Parsedown on the back . The main question is as follows: how to deal with transfers? Parsedown converts, say, a double carry to a single, single carry ignored. SimpleMDE, in turn, sees the transference as a transference, solitary, and adequately perceives it. When outputting text to a form (editing), you have to convert \r\n to so that the transfers are preserved inside the textarea . Are there any generally accepted approaches in such situations? Now I keep the text in the database "as is", as it came from the form. All formatting, etc. already at withdrawal. How to deal with hyphenation?
Added by:
It is probably more correct to even ask quite differently - are there any libraries that support both JS and PHP, in the sense that, roughly speaking, what text the user sees in the editor's preview, he will see that in the finished article. Because poking an extra transfer (so that there are two of them) is not at all difficult, provided that the author presses the Preview button here and sees that this has led to the desired result.
In general, I could not formulate a question for a very long time, because I come across such a task for the first time, and I don’t even know which way to dig more correctly - handling of transfers, or universalization of backsight and front parsing, or even somewhere else. Here, too, can be attributed and layout. Well, let it be SimpleMDE, it is built on some other library, in my opinion Marked, can you somehow assign a separate div, for example, to use Marked? Or some styles from Marked .. That is, for any tips I will be very grateful.
renderingConfig: {singleLineBreaks: ...}here github.com/sparksuite/simplemde-markdown-editor - Vismansimplemde.value({{ $article->body }})is somehow, in my opinion, firstly crooked, and secondly, there are absolutely no guarantees that everything will get there correctly, given that HTML itself carries; spaces kroppit. I just tried it already :) - Captain Flint