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 EGL 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.0.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.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: yamtl-pygments-lexer-1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 96f08b6cad9acf382ce816d07f780e6f58bdf3349bc032c42ecfac906c624a1d
MD5 fc2156db1d1c1516036d5574b51b894c
BLAKE2b-256 ba183d0a99335caf2dba8d06cf394e2859c56062b88eb487c7a7578a44eb280d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for yamtl_pygments_lexer-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c8773f80c286142256c9e56af250c251244bcda020f9278d7466bdadd4f2aa6d
MD5 484aff830f1af330877411c786dd9a99
BLAKE2b-256 496cf3d97143410fa50a86b38623375f729b75360ab22e33041b3bc8addbd0fa

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