Prism.js of JS Syntax highlighting plugin

Source: Internet
Author: User

Before also introduced several syntax highlighting plug-in "for the blog park to choose a small domineering syntax highlighting plug-in" and about their comprehensive performance "re-discuss the choice of syntax highlighting plugin."
Today in Xiaoying blog see "Using Prism.js to achieve beautiful code syntax highlighting" so whim went to see the next, by the way test performance.
Open Prism.js official website and see used by.

I'm not a small man.

Then read the next example, sure enough, a very interesting plug-in, so I downloaded to the local jQuery highlight rendering test.
The test method is the same as before, in order to compare with the previous plug-in, of course, my computer did not change, or the previous one, so can be compared.

I le a fork, unexpectedly want 48 seconds,, slow out of Xiang, the rhythm of the inverse of the day ah.


The matching accuracy is generally just 30,000 points.

Combined with the last test results, look at the ranking table again.

ranking name Render Time Number of nodes
1 Shjs 627ms 33985 Node
2 Pretiffy 1.26S 59802 Node
3 Highlight 567ms 8432 Node
4 Snippet 9.40S 43775 Node
5 Prism 48.56S 36225 Node

You can choose according to your own needs, but also to pay attention to compatibility. If you want all-rounder, the preferred codemirror.

Of course, Prism is not useless, or the big guy will not choose him.
The way he calls, the design of how human ah, these are we can learn from.
Of course, these features you use SHJS + JQuery is also very easy to implement, you can create a small and powerful syntax highlighting plug-in.

Well, this is the end of today's share.

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.