Giter VIP home page Giter VIP logo

latex-solidity's Introduction

pygments-lexer-solidity

Original README

Solidity and Yul 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.

Overview

LaTeX Repo README

This repo builds on top of the source which is can be located at https://gitlab.com/veox/pygments-lexer-solidity.

To use the lexer for LaTeX highlighting simply extract the lexer-latex.zip file and upload both the __init__.py and lexer.py in your document directory or use a service like overleaf.com

A reference LaTeX document and generated PDF are included. This was rendered and generated using the overleaf web application. see latex/example.pdf

LaTeX

Solidity

\begin{minted}{lexer.py:SolidityLexer -x}
   ... your code here ...
\end{minted}

Yul

\begin{minted}{lexer.py:YulLexer -x}
   ... your code here ...
\end{minted}

Installation

Set up your virtual environment, no matter how you do it.

 virtualenv .virtualenv/`basename $(pwd)`
 source .virtualenv/`basename $(pwd)`/bin/activate

Then install via PyPI:

 pip install pygments-lexer-solidity

Or from a local git repo:

 pip install -r requirements.txt
 pip install -e .

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

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 colorized HTML file:

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

License

BSD 2-clause simplified. See LICENSE.txt.

latex-solidity's People

Contributors

axic avatar maurelian avatar sambacha avatar veox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

latex-solidity's Issues

Corrections

Bancor, not uniswap first adopted this implementation for blockchains

Uniswaps utilization of create2 made it scalable wrt creation of deterministic trading pairs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.