npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

highlightjs-circom

v1.0.2

Published

Highlight.js syntax definition for the CIRCOM language

Readme

highlightjs-circom

npm version CI License: MIT

A Highlight.js language plugin that adds rich syntax highlighting for Circom — the domain-specific language used to write zero-knowledge arithmetic circuits (R1CS / SNARKs).


Features

  • Full keyword coverage: template, component, signal, input, output, bus, parallel, custom, extern_c, pragma, include, and all control-flow keywords
  • Circom-specific constraint operators highlighted at high relevance: <==, ==>, <--, -->, ===
  • Pragma directives (pragma circom 2.x.x, pragma custom_templates)
  • Include paths highlighted as strings
  • Tag annotations on signals and buses ({binary}, {edwards_point}, …)
  • Built-in functions: log, assert
  • Decimal and hexadecimal numeric literals
  • Line and block comments
  • Template, function, and bus names highlighted as title.function
  • Correct auto-detection: Circom code reliably detected via highlightAuto

Installation

npm install highlightjs-circom

highlight.js ≥ 11 is a peer dependency — install it separately if you haven't already:

npm install highlight.js

Usage

CommonJS / Node.js

const hljs = require("highlight.js");
const circom = require("highlightjs-circom");

hljs.registerLanguage("circom", circom.default ?? circom);

const code = `
pragma circom 2.1.5;

template Multiplier(n) {
    signal input a;
    signal input b;
    signal output c;
    c <== a * b;
}
`.trim();

const html = hljs.highlight(code, { language: "circom" }).value;
console.log(html);

ES Modules

import hljs from "highlight.js";
import circom from "highlightjs-circom";

hljs.registerLanguage("circom", circom);

const result = hljs.highlight(code, { language: "circom" });

Browser (CDN)

Load Highlight.js first, then load this plugin:

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.10.0/styles/github-dark.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.10.0/highlight.min.js"></script>
<!-- highlightjs-circom -->
<script src="https://unpkg.com/highlightjs-circom/dist/index.js"></script>
<script>
  hljs.registerLanguage("circom", window.hljsCircom?.default ?? window.hljsCircom);
  hljs.highlightAll();
</script>

Then mark up your code blocks:

<pre><code class="language-circom">
pragma circom 2.1.5;

template IsZero() {
    signal input in;
    signal output out;
    signal inv;
    inv <-- in != 0 ? 1/in : 0;
    out <== -in * inv + 1;
    in * out === 0;
}

component main = IsZero();
</code></pre>

Auto-detection

The plugin registers Circom with high relevance scores on constraint operators so highlightAuto correctly identifies Circom source files:

const result = hljs.highlightAuto(unknownCode);
console.log(result.language); // "circom"

Supported syntax elements

| Element | Highlight class | |---------|----------------| | pragma, include | hljs-meta | | Keywords (template, signal, component, …) | hljs-keyword | | Constraint operators (<==, ==>, ===, …) | hljs-operator | | Tag annotations {…} | hljs-type | | Template / function / bus names | hljs-title function_ | | Built-ins (log, assert) | hljs-built_in | | Literals (true, false) | hljs-literal | | Numeric literals | hljs-number | | String literals | hljs-string | | Comments | hljs-comment |


Example

pragma circom 2.1.5;
pragma custom_templates;

include "bitify.circom";

/*
 * Computes the bitwise AND of two n-bit numbers.
 */
template BitwiseAnd(n) {
    signal {binary} input a[n];
    signal {binary} input b[n];
    signal {binary} output out[n];

    for (var i = 0; i < n; i++) {
        out[i] <== a[i] * b[i];
    }
}

component main {public [a, b]} = BitwiseAnd(8);

Compatibility

| highlight.js | highlightjs-circom | |--------------|--------------------| | ≥ 11.0.0 | ✓ |


License

MIT © ABDK Consulting