Javascript-markdown parsing how to achieve consistent front-end effects

Source: Internet
Author: User
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 ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.