# highlightjs-solidity

> highlight.js syntax definition for Ethereum's Solidity language

Latest version **2.0.6** (published 2023-02-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install highlightjs-solidity
pnpm add highlightjs-solidity
yarn add highlightjs-solidity
bun add highlightjs-solidity
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.6 |
| Published | 2023-02-02 |
| First published | 2016-07-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 41 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11 |
| Author | pospi |
| Maintainers | marcosc, pospi, haltman |
| Keywords | Solidity, Ethereum, highlight.js, highlightjs, syntax |

## Links

- npm: https://www.npmjs.com/package/highlightjs-solidity
- Repository: https://github.com/pospi/highlightjs-solidity
- Homepage: https://github.com/highlightjs/highlightjs-solidity#readme
- Issues: https://github.com/highlightjs/highlightjs-solidity/issues
- npm.io page: https://npm.io/package/highlightjs-solidity

## Alternatives

- [@oh-my-pi/pi-natives](https://npm.io/package/@oh-my-pi/pi-natives.md) — 51.8K weekly downloads
- [@capgo/capacitor-light-sensor](https://npm.io/package/@capgo/capacitor-light-sensor.md) — 3.0K weekly downloads
- [@heyhuynhgiabuu/pi-diff](https://npm.io/package/@heyhuynhgiabuu/pi-diff.md) — 492 weekly downloads
- [@lotsa/verdant-lang-asm](https://npm.io/package/@lotsa/verdant-lang-asm.md) — 38 weekly downloads
- [new-era-syntax](https://npm.io/package/new-era-syntax.md) — 20 weekly downloads

## Recent versions

- 2.0.6 (latest) — 2023-02-02
- 2.0.5 — 2022-03-16
- 2.0.4 — 2022-02-16
- 2.0.3 — 2021-12-20
- 2.0.2 — 2021-11-09
- 2.0.1 — 2021-09-27
- 2.0.0 — 2021-08-26
- 1.2.2 — 2021-08-11
- 1.2.1 — 2021-08-06
- 1.2.0 — 2021-07-13
- 1.1.1 — 2021-06-15
- 1.1.0 — 2021-05-19
- 1.0.22 — 2021-04-22
- 1.0.21 — 2021-01-28
- 1.0.20 — 2020-12-17
- … 19 more at https://npm.io/package/highlightjs-solidity/versions

## README

`highlight.js` syntax definition for Solidity.

For more about highlight.js, see https://highlightjs.org/

For more about Solidity, see http://docs.soliditylang.org/

### Usage

If you're not using a build system and just want to embed this in your webpage:

```html
<script type="text/javascript" src="/path/to/highlight.min.js"></script>
<script type="text/javascript" src="/path/to/solidity.min.js"></script>
<script type="text/javascript" src="/path/to/yul.min.js"></script>
<script type="text/javascript">
    hljs.highlightAll();
</script>
```

If you're using webpack / rollup / browserify / node:
   
```javascript
var hljs = require('highlightjs');
var hljsDefineSolidity = require('highlightjs-solidity');

hljsDefineSolidity(hljs);
hljs.initHighlightingOnLoad();
```

Doing this will define both `solidity` and `yul` languages.

If you want to use this in your webpage, this package uses highlight.js's CDN build system to build its Solidity and Yul grammars.

### Compatibility

This package is not currently compatible with highlight.js version 11.

### Advanced

This is a pretty simple package, the only thing you might want to do differently is name the languages something other than `solidity` or `yul`. If you want to do this, simply `import { solidity, yul } from 'highlightjs-solidity';` and do `hljs.registerLanguage('othername1', solidity);` and `hljs.registerLanguage('othername2', yul);`.

### About the author

Originally authored by [pospi](http://pospi.spadgos.com), currently maintained by <img src="https://www.trufflesuite.com/img/truffle-logomark.svg" width="15" />[Truffle](https://www.trufflesuite.com/).

---
_Source: https://npm.io/package/highlightjs-solidity · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
