Comparison

If you are wondering what Photon offers that another syntax highlighter does not, welcome to this page.

Here are no biased opinions, just a few screenshots of some alternative syntax highlighters. Each project has its own strengths and we believe that we must show ours.

Neither do we intend to criticize these awesome libraries, which aside from being open source, community-based and used in thousands of projects, have served as inspiration.

If any result is wrong, you can tell us at github.com/photonsh/issues.

Setup

We have used the following popular libraries to create the comparison:

Reset

To make examples look similar we have used a few CSS rules to reset some values like spacing and fonts.

code, pre { 
  font-size: 12px !important;
  line-height: 18px !important;
  font-family: monospace !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 0 !important;
}

code {
  padding: 24px !important;
}

code {
  display: block !important;
}

div.psh {
  margin: 0 !important;
}

Results

Round 1 - JavaScript

In this round we test JavaScript syntax highlighting.

Themes are the default one for each proyect.

Photon - Javascript - Default Theme (photon-light)

Photon - Javascript - Default Theme

Highlight.js - Javascript - Default Theme (default)

Highlight.js - Javascript - Default Theme

Prism - Javascript - Default Theme (default)

Prism - Javascript - Default Theme

Round 2 - Python

In this round we test Python syntax highlighting.

Themes are Monokai or similar version.

Photon - Python - Monokai Theme (monokai)

Photon - Python - Monokai Theme

Highlight.js - Python - Monokai Theme (monokai-sublime)

Highlight.js - Python - Monokai Theme

Prism - Python - Monokai Theme (okaidia)

Prism - Python - Monokai Theme

Round 3 - PHP

In this round we test PHP syntax highlighting.

Themes are GitHub or similar version.

Photon - PHP - GitHub Theme (github-light)

Photon - PHP - GitHub Theme

Highlight.js - PHP - GitHub Theme (github)

Highlight.js - PHP - GitHub Theme

Prism - PHP - GitHub Theme (coy)

Prism - PHP - GitHub Theme

Round 4 - Ruby

In this round we test Ruby syntax highlighting.

Themes are Solarized Light or similar version.

Photon - Ruby - Solarized Light Theme (solarized-light)

Photon - Ruby - Solarized Light Theme

Highlight.js - Ruby - Solarized Light Theme (solarized-light)

Highlight.js - Ruby - Solarized Light Theme

Prism - Ruby - Solarized Light Theme (solarizedlight)

Prism - Ruby - Solarized Light Theme