Skip to main content

Pygments lexer for YAMTL variants.

Project description

YAMTL Plugin for Pygments

Pygments lexer support for YAMTL variants (ready to use with MkDocs Material)

Installation

If you want to install it from PyPI:

pip install yamtl-pygments-lexer

OR

If you want to run the latest package via GitHub:

git clone https://github.com/iNafey/yamtl-pygments-lexer.git
cd yamtl-pygments-lexer
sudo python setup.py install

Please note: the site-packages/easy-install.pth file (generated by the above command) needs to not include a relative path but a full path to the egg file. You could also replace the last line for (sudo python setup.py develop) if you will make changes to the code.

Usage

To use any of the YAMTL lexers, you need to have Pygments installed (so you can use the pygmentize command). Then, you can perform syntax highlighting using the following command:

 pygmentize -l <LexerAlias> -x <RelativePathToFile>

Where LexerAlias is the alias of the lexer you want to use (e.g. yamtl-groovy for Groovy-variant of YAMTL) and RelativePathToFile is the relative path to the file you want to highlight.

For example, if you want to highlight the file test.groovy using the Groovy-flavoured YAMTL lexer, you would use:

 pygmentize -l yamtl-groovy -x test_scripts/test.groovy

MkDocs Material Support

If you want to use the lexers with MkDocs Material, simply call the LexerAlias in the code blocks of your Markdown files. For example, if you want to highlight a Groovy code block using the Yamtl-Groovy lexer, you would use:

    ``` yamtl-groovy
        //MT definition containing rules
    ```

Color Customization

You can select from various pygments styles already available for highlighting within the terminal:

 pygmentize -O <StyleName>  -l <LexerAlias> -x <RelativePathToFile>

Where StyleName is the name of the style you want to use (e.g. monokai). The default style is default.

To change the style for MkDocs Material, you will need to find the token types of the keywords you want to highlight (Inspect Element via your browser). Then, follow the instructions here to add the custom style to your documentation site.

Available YAMTL lexers based on JVM languages

  • Groovy variant : yamtl-groovy
  • Xtend variant: yamtl-xtend
  • Java variant: yamtl-java
  • Kotlin variant: yamtl-kotlin

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

yamtl-pygments-lexer-1.1.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yamtl_pygments_lexer-1.1-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file yamtl-pygments-lexer-1.1.tar.gz.

File metadata

  • Download URL: yamtl-pygments-lexer-1.1.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for yamtl-pygments-lexer-1.1.tar.gz
Algorithm Hash digest
SHA256 9c96278b2a14431ad378ca289ce3a175560e7b659490d6affdcb4b72be0b4696
MD5 7ce0920521910a090341cb34c23756b3
BLAKE2b-256 9749700d6936984e259311ff70f6a6f731cad98a5fba15299f55d1bbfb7be984

See more details on using hashes here.

File details

Details for the file yamtl_pygments_lexer-1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for yamtl_pygments_lexer-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2ddd1feb01964ab8924c2c4ce0face7082b388b76f77f9e9acba707d1f942e90
MD5 249352a783e7fa903427473b07cc0260
BLAKE2b-256 8228733112e1175afc3870ff3dd9ce5dd5804ce60f2ea6bbcc175322f5007209

See more details on using hashes here.

Supported by

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