It seems that I can also call this topic, there are some reliable markdown library, commonly used JS and PHP library I have used, but there is a problem is the front and back effects inconsistent.
It seems that SF also has this problem, the front-end with JS rendering, the back end with PHP, they always have so little difference, I know that with node. JS can take all, but the problem is that I could not casually replace the backend language, there is a good solution
Reply content:
It seems that I can also call this topic, there are some reliable markdown library, commonly used JS and PHP library I have used, but there is a problem is the front and back effects inconsistent.
It seems that SF also has this problem, the front-end with JS rendering, the back end with PHP, they always have so little difference, I know that with node. JS can take all, but the problem is that I could not casually replace the backend language, there is a good solution
In the external self-built a Markdown parsing service (node. js) API, it is good to resolve the unification. This allows you to achieve results without switching languages.
PHP and JS codes can be converted to each other. There is a project called Phpjs, which provides a lot of PHP base function js.
The rest is just a conversion of the language. Simply put: porting the backend algorithm to the front end. (And, of course, it's OK ...) )
I've often encountered these problems before, and have done so many times by hand, and can actually do it all in a program. JS and PHP are really like, and it's easy to say the truth.
No more said, someone has done it: https://code.google.com/p/php-to-js/
And this: Https://github.com/Danack/PHP-to-Javascript
If you cannot change the backend language randomly, the simplest way is to use your backend language to call Node in the process call to process the file, and then read the results back.
Of course there is a more troublesome way ... Is the front-end algorithm and the back-end algorithm unified, according to the algorithm meticulous in the front and back of the implementation of the ...