Liquid HTML parser by Shopify
npm install @shopify/liquid-html-parser
This module provides the Liquid HTML parser that powers the prettier plugin, linter and language server for Liquid-powered Shopify themes.
It turns a .liquid file contents into an Abstract Syntax Tree (AST) that contains _both_ Liquid and HTML nodes.
``bashwith npm
npm install @shopify/liquid-html-parser
Usage
`ts
import { toLiquidHtmlAST, LiquidHtmlNode, NodeTypes } from '@shopify/prettier-plugin-liquid';const ast: LiquidHtmlNode = toLiquidHtmlAST(
);
`You should know
Because Liquid is very permissive, things like the
name of an HTML tag may have a surprising type: an array of LiquidVariableOutput | TextNode. This is because the following use cases are supported by the parser:
`liquid
{% # compound html tag names %}
{% # compound html attribute names %}
![]()
``MIT.