PHPackages                             intelogie/highlight - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. intelogie/highlight

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

intelogie/highlight
===================

Highlight.js package

0143JavaScript

Since Oct 3Pushed 10y ago1 watchersCompare

[ Source](https://github.com/INTELOGIE/highlight.js)[ Packagist](https://packagist.org/packages/intelogie/highlight)[ RSS](/packages/intelogie-highlight/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Highlight.js
============

[](#highlightjs)

[![Build Status](https://camo.githubusercontent.com/cb7a7834912459c4b9569c5c3c2c65b7535246815c2869a559fc59134ccc8a3d/68747470733a2f2f7472617669732d63692e6f72672f69736167616c6165762f686967686c696768742e6a732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/isagalaev/highlight.js)

Highlight.js is a syntax highlighter written in JavaScript. It works in the browser as well as on the server. It works with pretty much any markup, doesn’t depend on any framework and has automatic language detection.

Getting Started
---------------

[](#getting-started)

The bare minimum for using highlight.js on a web page is linking to the library along with one of the styles and calling [`initHighlightingOnLoad`](http://highlightjs.readthedocs.org/en/latest/api.html#inithighlightingonload):

```

hljs.initHighlightingOnLoad();
```

This will find and highlight code inside of `` tags; it tries to detect the language automatically. If automatic detection doesn’t work for you, you can specify the language in the `class` attribute:

```
...
```

The list of supported language classes is available in the [class reference](http://highlightjs.readthedocs.org/en/latest/css-classes-reference.html). Classes can also be prefixed with either `language-` or `lang-`.

To disable highlighting altogether use the `nohighlight` class:

```
...
```

Custom Initialization
---------------------

[](#custom-initialization)

When you need a bit more control over the initialization of highlight.js, you can use the [`highlightBlock`](http://highlightjs.readthedocs.org/en/latest/api.html#highlightblock-block) and [`configure`](http://highlightjs.readthedocs.org/en/latest/api.html#configure-options)functions. This allows you to control *what* to highlight and *when*.

Here’s an equivalent way to calling [`initHighlightingOnLoad`](http://highlightjs.readthedocs.org/en/latest/api.html#inithighlightingonload) using jQuery:

```
$(document).ready(function() {
  $('pre code').each(function(i, block) {
    hljs.highlightBlock(block);
  });
});
```

You can use any tags instead of `` to mark up your code. If you don't use a container that preserve line breaks you will need to configure highlight.js to use the `` tag:

```
hljs.configure({useBR: true});

$('div.code').each(function(i, block) {
  hljs.highlightBlock(block);
});
```

For other options refer to the documentation for [`configure`](http://highlightjs.readthedocs.org/en/latest/api.html#configure-options).

Getting the Library
-------------------

[](#getting-the-library)

You can get highlight.js as a hosted, or custom-build, browser script or as a server module. Right out of the box the browser script supports both AMD and CommonJS, so if you wish you can use RequireJS or Browserify without having to build from source. The server module also works perfectly fine with Browserify, but there is the option to use a build specific to browsers rather than something meant for a server. Head over to the [download page](https://highlightjs.org/download/) for all the options.

**Note:** the library is not supposed to work straight from the source on GitHub; it requires building. If none of the pre-packaged options work for you refer to the [building documentation](http://highlightjs.readthedocs.org/en/latest/building-testing.html).

License
-------

[](#license)

Highlight.js is released under the BSD License. See [LICENSE](https://github.com/isagalaev/highlight.js/blob/master/LICENSE) file for details.

Links
-----

[](#links)

The official site for the library is at .

Further in-depth documentation for the API and other topics is at .

Authors and contributors are listed in the [AUTHORS.en.txt](https://github.com/isagalaev/highlight.js/blob/master/AUTHORS.en.txt) file.

###  Health Score

23

—

LowBetter than 30% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 53.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/8cd960536c07e255b2e6f7e55c03c6d09274b215ccceaccc38926ffe03e098a7?d=identicon)[bgauthier](/maintainers/bgauthier)

---

Top Contributors

[![isagalaev](https://avatars.githubusercontent.com/u/99931?v=4)](https://github.com/isagalaev "isagalaev (1462 commits)")[![sourrust](https://avatars.githubusercontent.com/u/365596?v=4)](https://github.com/sourrust "sourrust (593 commits)")[![Sannis](https://avatars.githubusercontent.com/u/77367?v=4)](https://github.com/Sannis "Sannis (312 commits)")[![EricFromCanada](https://avatars.githubusercontent.com/u/3324775?v=4)](https://github.com/EricFromCanada "EricFromCanada (37 commits)")[![atelierbram](https://avatars.githubusercontent.com/u/849801?v=4)](https://github.com/atelierbram "atelierbram (31 commits)")[![Daiz](https://avatars.githubusercontent.com/u/3596343?v=4)](https://github.com/Daiz "Daiz (27 commits)")[![bolknote](https://avatars.githubusercontent.com/u/392509?v=4)](https://github.com/bolknote "bolknote (25 commits)")[![makenowjust](https://avatars.githubusercontent.com/u/6679325?v=4)](https://github.com/makenowjust "makenowjust (23 commits)")[![ozlerhakan](https://avatars.githubusercontent.com/u/1964927?v=4)](https://github.com/ozlerhakan "ozlerhakan (22 commits)")[![chriseidhof](https://avatars.githubusercontent.com/u/5382?v=4)](https://github.com/chriseidhof "chriseidhof (20 commits)")[![lucaswerkmeister](https://avatars.githubusercontent.com/u/2346599?v=4)](https://github.com/lucaswerkmeister "lucaswerkmeister (16 commits)")[![sv](https://avatars.githubusercontent.com/u/14086?v=4)](https://github.com/sv "sv (13 commits)")[![idleberg](https://avatars.githubusercontent.com/u/1504938?v=4)](https://github.com/idleberg "idleberg (13 commits)")[![lsegal](https://avatars.githubusercontent.com/u/686?v=4)](https://github.com/lsegal "lsegal (12 commits)")[![scemama](https://avatars.githubusercontent.com/u/5970658?v=4)](https://github.com/scemama "scemama (12 commits)")[![treep](https://avatars.githubusercontent.com/u/206443?v=4)](https://github.com/treep "treep (10 commits)")[![mariusschulz](https://avatars.githubusercontent.com/u/947523?v=4)](https://github.com/mariusschulz "mariusschulz (9 commits)")[![vast](https://avatars.githubusercontent.com/u/25136?v=4)](https://github.com/vast "vast (9 commits)")[![non](https://avatars.githubusercontent.com/u/218045?v=4)](https://github.com/non "non (8 commits)")[![lucasmazza](https://avatars.githubusercontent.com/u/80978?v=4)](https://github.com/lucasmazza "lucasmazza (8 commits)")

### Embed Badge

![Health badge](/badges/intelogie-highlight/health.svg)

```
[![Health](https://phpackages.com/badges/intelogie-highlight/health.svg)](https://phpackages.com/packages/intelogie-highlight)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
