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.1.tar.gz (10.1 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.1-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pygments_liquid2-0.1.1.tar.gz
  • Upload date:
  • Size: 10.1 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.1.tar.gz
Algorithm Hash digest
SHA256 ce549e2dcb6954391eff6dee8e66be4e92455120c52b255945d8922254bdf596
MD5 2e5a9efc54ad06b516b6955838993a5e
BLAKE2b-256 ef445377d61259919cb5c968089a068d0bb57833d800c6572856eb7e95c3476b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygments_liquid2-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8b3ee2d7820036cefcc44974fb240c7206105375bb1a7eb6ac9c196aba109402
MD5 1a3e985bb919fa70581a7c1679d17495
BLAKE2b-256 eadd3068620205a97b1501d34b163b24ef176e722c8ced1a11634c2f566622e8

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