Skip to content

Latest commit

 

History

History
36 lines (24 loc) · 878 Bytes

readme.md

File metadata and controls

36 lines (24 loc) · 878 Bytes

@liquify/highlight

Syntax highlighting for Liquid on the command line. Uses cli-highlight under the hood but does some extra post-processing when dealing with contained syntaxes. It applies Potion themed token colorization.

Why?

This module was created for usage by the Prettify CLI but has been appropriated in different packages and projects across the Liquify monorepo workspace.

Install

pnpm add @liquify/highlight ava -D

Usage

import highlight from '@liquify/highlight';

const string = `
{% if condition %}

  <div class="xxx">
    {{ object.prop | filter: 'something' }}
  </div>

{% endif %}
`

// Returns a coloured string
highlight(string)

// Logs the coloured string
highlight.log(string)