0.1.0 • Published 1 year ago

@liquify/highlight v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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