liquid
liquid copied to clipboard
Remove blank nodes from AST with omit_blank_nodes option
By using omit_blank_nodes parse option, Parser will omit Comment node and other empty nodes from the AST.
For example, If tag like this won't be included in the AST:
source = <<~LIQUID
{% if foo > 1 %}
{% endif %}
LIQUID
Liquid::Template.parse(source, omit_blank_nodes: true)
I think this means comments won't be available in the AST anymore right? That might break tools using AST walking to inspect comments.
I only know of https://github.com/Shopify/theme-check, but it's deprecated. So might be good.
Do you think that might be an issue?
I think this means comments won't be available in the AST anymore right? That might break tools using AST walking to inspect comments.
I only know of https://github.com/Shopify/theme-check, but it's deprecated. So might be good.
Do you think that might be an issue?
oh good point... it should be configurable to omit these nodes 👍
Hello from an AST-walking codebase! 👋 Thanks for thinking of us! 🥰