Skip to main content

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.

Metadata

Release files for pygments-liquid2 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pygments-liquid2 0.2.0
File Size Uploaded Provenance Actions
pygments_liquid2-0.2.0.tar.gz 10.3 kB Without provenance Details for pygments_liquid2-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pygments-liquid2 0.2.0
File Interpreter ABI Platform Actions
pygments_liquid2-0.2.0-py3-none-any.whl Python 3 none any Details for pygments_liquid2-0.2.0-py3-none-any.whl

Total release size: 30.5 kB

Release files / pygments_liquid2-0.2.0.tar.gz

Download URL pygments_liquid2-0.2.0.tar.gz
Size 10.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ef4e3151010dec1bf650be409bd44adfb70d6a6da7146291bbd27b2c60712eba
BLAKE2b-256 checksum
How to use checksums
9f3c302426575e22b83a1c1a28dbdd53cec61742729e170eef9126bcf7e4f045
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.2

Release files / pygments_liquid2-0.2.0-py3-none-any.whl

Download URL pygments_liquid2-0.2.0-py3-none-any.whl
Size 20.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d710eb7ab3e0ed98b94ace2b5e944d377ed8a9ba47a817c9c8e0138dbb1ca3b5
BLAKE2b-256 checksum
How to use checksums
1d91f57a20ca381954d04f6b923ef527c7a7d0bfe9fe0e3e4aa162ad9af79e41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.2

Security for pygments-liquid2 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page