Skip to main content

No project description provided

Project description

Pygments Liquid2

Some Liquid lexers for Pygments.

License Tests PyPI - Downloads
PyPi - Version Python versions


Table of Contents

Installation

pip install pygments-liquid2

This package uses the Pygments plugin entry point, so, if its installed in your Python environment, additional Liquid lexers will be available automatically. Confirm this by listing lexers with one of the following methods.

Listing lexers on the command line:

pygmentize -L lexers | grep -i liquid
* html+liquid, htmlliquid:
    HTML+Liquid (filenames *.html.liquid, *.htm.liquid, *.xhtml.liquid)
* html+liquid2, html+liquid, htmlliquid:
    HTML+Liquid2 (filenames *.html.liquid, *.htm.liquid, *.xhtml.liquid)
* liquid2, liquid:
    liquid2 (filenames *.liquid)
* liquid:
    liquid (filenames *.liquid)
* liquid:
    liquid-std (filenames *.liquid)

Listing lexers with Python

from pygments.lexers import get_all_lexers

all_lexers = get_all_lexers(plugins=True)
liquid_lexers = sorted(lexer for lexer in all_lexers if "liquid" in lexer[0].lower())

for name, aliases, _filenames, _mimetypes in liquid_lexers:
    print(f"{name}: {aliases}")

Available lexers

After installation, these Liquid lexers should be available.

liquid

The Liquid lexer built in to Pygments.

This lexer is importable from Python using from pygments.lexers import LiquidLexer.

liquid-std

An alternative Liquid lexer for Shopify/Liquid syntax. This lexer makes the following changes over the built-in Liquid lexer.

  • Add support for nested block comments (those with balanced comment/endcomment tags).
  • Add support for whitespace control, like {{- some.thing -}}.
  • Add support for inline comment tags, like {% # some comment %}.
  • Add support for {% liquid %} tags.
  • Add support for bracketed variable and index, like foo[bar]["with a space"][1].
  • Allow tag and output expressions to span multiple lines.
  • Remove the logical not keyword.

This lexer is importable from Python using from pygments_liquid2 import StandardLiquidLexer.

html+liquid

A DelegatingLexer for highlighting HTML with standard Liquid markup.

This lexer is importable from Python using from pygments_liquid2 import HtmlLiquidLexer.

liquid2

A Liquid lexer with the following extended syntax over liquid-std described above.

  • Add support for new style comments, like {# some comment #}.
  • Add support for template strings, like {{ "Hello, ${you | upcase}" }}.
  • Add some extra keywords.
  • Add support for scientific notation for floats and integers.
  • Add more whitespace control characters, like {{+ some.thing ~}}.

This lexer is importable from Python using from pygments_liquid2 import Liquid2Lexer.

html+liquid2

A DelegatingLexer for highlighting HTML with Liquid2 markup.

This lexer is importable from Python using from pygments_liquid2 import HtmlLiquid2Lexer.

Lexer priority

liquid2 and html+liquid2 are given a higher priority than the Liquid lexer built-in to Pygments and liquid-std. So, when using Pygments functions like get_lexer_for_filename() and guess_lexer(), you should expect to get a Liquid2 lexer over a standard Liquid lexer.

License

pygments-liquid2 is distributed under the terms of the BSD-2-Clause license.

We've used bits and pieces from lexers built-in to Pygments, so we included their BSD-2-Clause license too.

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_liquid2-0.2.0.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

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

pygments_liquid2-0.2.0-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

Details for the file pygments_liquid2-0.2.0.tar.gz.

File metadata

  • Download URL: pygments_liquid2-0.2.0.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.2

File hashes

Hashes for pygments_liquid2-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ef4e3151010dec1bf650be409bd44adfb70d6a6da7146291bbd27b2c60712eba
MD5 966e72e101032bd9097baea041cbb56d
BLAKE2b-256 9f3c302426575e22b83a1c1a28dbdd53cec61742729e170eef9126bcf7e4f045

See more details on using hashes here.

File details

Details for the file pygments_liquid2-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pygments_liquid2-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d710eb7ab3e0ed98b94ace2b5e944d377ed8a9ba47a817c9c8e0138dbb1ca3b5
MD5 5f37f9ac03fff0cd8927ca64fea70ed5
BLAKE2b-256 1d91f57a20ca381954d04f6b923ef527c7a7d0bfe9fe0e3e4aa162ad9af79e41

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