Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Apr 26, 2024 via pnpm

highlight.js 11.9.0

Syntax highlighting with language autodetection.
Package summary
Share
0
issues
1
license
1
BSD-3-Clause
Package created
15 Jul 2011
Version published
9 Oct 2023
Maintainers
4
Total deps
1
Direct deps
0
License
BSD-3-Clause

Issues

0
This package has no issues

Licenses

BSD 3-Clause "New" or "Revised" License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
place-warranty
Cannot
use-trademark
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
highlight.js@11.9.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of highlight.js 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does highlight.js do?

Highlight.js is an open-source JavaScript library that offers syntax highlighting for web applications. It's written in JavaScript, and is designed to be used both in a browser and on the server. The main feature of this JavaScript utility is syntax highlighting in over 180 languages, covering most popular programming languages. Despite its broad language coverage, Highlight.js is framework-agnostic and doesn't depend on any other libraries, making it a versatile tool for web developers.

How do you use highlight.js?

To use highlight.js in your web application, you need to include the library and one of the themes in your HTML file. Then, you call the highlightAll method from the hljs object. This method will find and highlight code inside <pre><code> tags, trying to automatically detect the language. Here is an example:

<link rel="stylesheet" href="/path/to/highlight.js/styles/default.min.css">
<script src="/path/to/highlight.js"></script>
<script>hljs.highlightAll();</script>

Specific languages can be manually specified using the class attribute:

<pre><code class="language-html">...</code></pre>

In case you want to use highlight.js on the server, you can load the library and then use the highlightAuto method:

const hljs = require('highlight.js');
const highlightedHTML = hljs.highlightAuto('<h1>Hello, world!</h1>').value;

For a smaller footprint, load only selected list of languages:

const hljs = require('highlight.js/lib/core');
hljs.registerLanguage('xml', require('highlight.js/lib/languages/xml'));

To highlight code in a specific language, highlight method is utilized:

const highlightedHTML = hljs.highlight('<h1>Hello, world!</h1>', {language: 'xml'}).value

Where are the highlight.js docs?

The official highlight.js documentation is available on the Highlight.js Read the Docs page. The document includes the library's API, usage guides, a detailed list of supported languages, theme guidelines, and more. You can also find additional information on their official website at https://highlight.js.org/. More technical details regarding the library's design, build process and compatibility requirements can be found in the library's GitHub repository: git://github.com/highlightjs/highlight.js.git.