Skip to content

Files

Latest commit

 

History

History
 
 

highlight

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

@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)