-
I am trying to build a Liquid code editor using liquidjs. When creating an AST of this code {% if customer.name == "kevin" %}
Hey Kevin!
{% elsif customer.name == "anonymous" %}
Hey Anonymous!
{% else %}
Hi Stranger!
{% endif %} All identifier tokens inside |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
The parsed templates returned by I'm still not sure should we provide such a general parser inside LiquidJS project. But https://codemirror.net/ supports Liquid language and there's a liquid parser implemented in BNF style: https://github.com/codemirror/lang-liquid |
Beta Was this translation helpful? Give feedback.
-
@harttle Thank you for the references, this will help guide our implementation. And also, thank you for liquidjs which we use in our product every day 😃 . |
Beta Was this translation helpful? Give feedback.
The parsed templates returned by
.parse()
cannot be serialized back to liquid template, that means it's not a AST can be used for code editors.I'm still not sure should we provide such a general parser inside LiquidJS project. But https://codemirror.net/ supports Liquid language and there's a liquid parser implemented in BNF style: https://github.com/codemirror/lang-liquid