Syntax Highlighting as a Service

Photon is a powerful, multiplatform, highly customizable and free syntax highlighter for the modern web.

JavaScript
import compose from './compose'

/**
 * Creates a store enhancer that applies middleware to the dispatch method
 * of the Redux store.
 *
 * @param {...Function} middlewares The middleware chain to be applied.
 * @returns {Function} A store enhancer applying the middleware.
 */
export default function applyMiddleware(...middlewares) {
  return (createStore) => (reducer, preloadedState, enhancer) => {
    const store = createStore(reducer, preloadedState, enhancer)
    let dispatch = store.dispatch
    let chain = []

    const middlewareAPI = {
      getState: store.getState,
      dispatch: (action) => dispatch(action)
    }
    chain = middlewares.map(middleware => middleware(middlewareAPI))
    dispatch = compose(...chain)(store.dispatch)

    return {
      ...store,
      dispatch
    }
  }
}
Get Started
Haskell
isSubsequenceOf :: (Eq a) => [a] -> [a] -> Bool
Python
cookie = self.headers.get('Cookie') or self.headers.get('cookie')
Vue.js
<comp :foo="bar" @update:foo="val => bar = val"></comp>
JavaScript
export default (fn, array) => [].concat.apply([], array.map(fn));
Swift
let catCharacters: [Character] = ["C", "a", "t", "!", "🐱"]
Scala
implicit def doubleArrayToVector(arr: Array[Double]) = new DoubleVector(arr)

Unique in its kind

Photon supports more than 300 languages.

Quantity or quality? Both

Instead of trying to find the language syntax using general regular expressions, Photon lexically analyzes the snippet to produce a much more complete and accurate highlighting, even when using the latest language features.

Compare results

Photon ❤ Your stack

You can highlight code on the client-side or the server-side. Photon works everywhere.

What makes Photon different?

You can use Photon inside your current environment, we do not force you to use any particular stack. We offer libraries for the most used languages and platforms. Also, you can highlight code by just making an HTTP call to the API.

View libraries

Compatibility
  • Ownership

    Ownership

    You are the owner of your code. You do not have to upload your code to any website that may disappear tomorrow. Regain control of your content.

  • Extensibility

    Extensibility

    We have created a complete collection of easy to use plugins that provide expressiveness and readability to your code snippets.

  • Appearance

    Appearance

    Improve the visual appearance of your code with more than 40 awesome themes availables. You can also create your own themes or modify existing ones! Total freedom.

  • Semantics

    Semantics

    We respect and value the web standards and all the code that we generate is done in the most correct way possible. From HTML tags to CSS rules.

We are creating more services and tools for developers. Stay tuned for new launch announcements.
No spam, unsubscribe at any time.