Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
pygments-lexer-solidity
Advanced tools
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.8.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.
Set up your virtual environment, no matter how you do it.
.. code-block:: shell
% virtualenv .virtualenv/basename $(pwd)
% source .virtualenv/basename $(pwd)
/bin/activate
Then install via PyPI:
.. code-block:: shell
% pip install pygments-lexer-solidity
Or from a local git repo:
.. code-block:: shell
% pip install -r requirements.txt % pip install -e .
Depends on doc-building infrastructure.
Sphinx ^^^^^^
Have this in Sphinx's conf.py
:
.. code-block:: python
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 ^^^^^^^^^^^^
To test a local copy of the lexer on the CLI:
.. code-block:: shell
% pygmentize -x -l pygments_lexer_solidity/lexer.py:SolidityLexer example.sol
To generate a colorised HTML file:
.. code-block:: shell
% pygmentize -v -O full,style=fruity -o example.sol.html example.sol
BSD 2-clause simplified. See LICENSE.txt
.
FAQs
Solidity lexer for Pygments (includes Yul intermediate language)
We found that pygments-lexer-solidity demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.