Don't throw syntax errors in {% comment %} blocks
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 11.9k
- Forks
- 1.5k
- Avg merge
- 17h 55m
- Merged PRs (30d)
- 3
Description
This is a bit of an opinion piece, but I don't think we should be throwing syntax errors for liquid in a comment block. A use case for comments is excluding code that you don't want to run—this means it may be incomplete and not working. I think this was already considered to a degree since there's an escape hatch for tags that aren't registered (via unknown_tag overwrite). For example:
This will successfully parse:
{% comment %}
{% not_a_valid_tag %}
{% endcomment %}
This will throw a syntax error:
{% comment %}
{% cycle %}
{% endcomment %}
I believe both of these should parse without error.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by examining how the parser handles {% comment %} blocks and how unknown_tag and cycle tags are validated. Reproduce the two Liquid examples from the issue, then verify that both incomplete and registered-but-invalid tags inside comments parse without syntax errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100