0.0.1 • Published 1 year ago

highlightjs-solidity-ts v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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:

<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:

import hljs from "highlight.js";
import hljsDefineSolidity from "highlightjs-solidity-ts";

hljsDefineSolidity(hljs);

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 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, forked from Truffle, refactored and maintained by sebastinez