A magnifying glass held over a trail of footprints, one print enlarged under the lens
Trusted third parties1 min read

Embed highlight.js code highlighting on my site

highlight.js colours code samples on your page and guesses the language for you, so you do not have to label every block. Good for a how-to page with snippets in several languages.

The prompt

Colour the code blocks on the Integrations page with highlight.js and use the GitHub dark theme.

Signed in, Get my prompt fills in your site for you. Otherwise press Copy and fill in the [bracketed] parts. First time? Connect your AI to bernard once: Use your own AI (opens in a new tab).

Ask your AI

Colour the code blocks on the Integrations page with highlight.js and use the GitHub dark theme.

What bernard checks

highlight.js code highlighting is on bernard’s permitted list. Someone read the maker’s own instructions (https://highlightjs.org/#usage) on 2026-09-14 and decided it was safe to run on a customer’s site: hljs.highlightAll() takes no arguments, so the init lane admits an empty tuple and nothing else. The browser bundle is published under @highlightjs/cdn-assets; the advisory watch should follow the highlight.js advisories. Your site loads it from its published package, version 11.9.0 or newer, at a version bernard pins and only ever moves forward.

Your AI writes the exact tag bernard permits, on a private preview. You look at it and approve it before anything goes live.

People search for this as: code, syntax highlighting, highlight.js, code block, snippet.

For the full list of libraries, what is waiting, and how to ask for one that is not there, see Embed a calendar, a diagram, a chart or another tool on my site.

Questions people ask

Do I need to write any code to use highlight.js code highlighting?
No. Your AI writes the exact tag bernard permits and puts it on a preview. You approve it before it goes live, and pasted code is removed for safety every time.
Is highlight.js code highlighting safe on my site?
bernard admits it only from its own published address, with its settings written as plain data rather than code, at a version bernard pins and only ever moves forward. Nothing else about it can be changed from a page.
Can I change it later?
Yes. Say what you want different and your AI redoes it on a preview for you to approve. Nothing about it is baked in.

Next