https://github.com/highlightjs/highlightjs-solidity
https://github.com/highlightjs/highlightjs-solidity
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/highlightjs/highlightjs-solidity
- Owner: highlightjs
- License: wtfpl
- Created: 2019-02-19T05:56:06.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-03-23T11:59:55.000Z (over 1 year ago)
- Last Synced: 2024-04-14T02:10:09.383Z (about 1 year ago)
- Language: JavaScript
- Size: 79.1 KB
- Stars: 47
- Watchers: 6
- Forks: 17
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
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
hljs.highlightAll();
```
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
[Truffle](https://www.trufflesuite.com/).