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 this packages is installed in your Python environment, additional Liquid lexers will be available automatically. Confirm this by listing available 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.1.0.tar.gz (9.9 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.1.0-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pygments_liquid2-0.1.0.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.10

File hashes

Hashes for pygments_liquid2-0.1.0.tar.gz
Algorithm Hash digest
SHA256 80729082404d8ce919aea95d860f9e5dc68d2bc518e2b155ed279f99a4d1bd25
MD5 2e959f626ca40ad80b0a0709764e3ddd
BLAKE2b-256 14aba385394b0fc79c9331f7c62061ecd6b23cc96a9d0e4ac127aedff0320e97

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygments_liquid2-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ab3ebe405bef64e4e14cc49ab5cba9d37f9843186317fde86457362fec2874f5
MD5 5cf9b9f878bacdf9d190ed55d3994244
BLAKE2b-256 20e2935fbcd13a073b9e24f887c4d7e5b24cfa40ad3056aa6f6dd2722c352adc

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