Skip to main content

Solidity lexer for Pygments (includes Yul intermediate language)

Project description

Solidity lexer for Pygments, distributed as a PyPI package.

If you want pretty syntax highlighting in documentation for Solidity files, and you’re using Pygments, this might just be the thing for you.

Currently, Solidity keywords up to version 0.6.0 are included, to the best of my ability. MRs are welcome!

The Yul intermediate language is also supported, including for stand-alone code blocks.

Installation

pip install pygments-lexer-solidity

Usage

Depends on doc-building infrastructure.

Sphinx

Have this in Sphinx’s conf.py:

from sphinx.highlighting import lexers
from pygments_lexer_solidity import SolidityLexer, YulLexer
lexers['solidity'] = SolidityLexer()
lexers['yul'] = YulLexer()

Then use .. code-block:: solidity for Solidity code blocks, or .. code-block:: yul for Yul.

Command-line

If you just want to test a local copy of the lexer on the CLI:

% pygmentize -x -l pygments_lexer_solidity/lexer.py:SolidityLexer example.sol

To generate a colorised HTML file:

% pygmentize -v -O full,style=fruity -o sol.html example.sol

License

BSD 2-clause simplified. See LICENSE.txt.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygments-lexer-solidity-0.5.1.tar.gz (6.9 kB view details)

Uploaded Source

File details

Details for the file pygments-lexer-solidity-0.5.1.tar.gz.

File metadata

  • Download URL: pygments-lexer-solidity-0.5.1.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for pygments-lexer-solidity-0.5.1.tar.gz
Algorithm Hash digest
SHA256 024bb0126b39accb30a526bf485c391444befb849dcd9d6b8dd3e7d32d7c3ccf
MD5 7cfd7232497a3650efa28ffa442597fe
BLAKE2b-256 b5b6be4ab824afe22391dba5f723f18a8160357e4de626f0395af073007073b4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page