LiquidHTMLSyntaxError false positive with dynamic html tag
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 234
- Forks
- 92
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 6
Description
The @shopify/liquid-html-parser package throws LiquidHTMLSyntaxError for the following code:
<{% if true %}div{% endif %}></{% if true %}div{% endif %}>
Full error:
SyntaxError: expected a letter, "{{", "wbr" (case-insensitive), "track" (case-insensitive), "source" (case-insensitive), "param" (case-insensitive), "meta" (case-insensitive), "link" (case-insensitive), "keygen" (case-insensitive), "input" (case-insensitive), "img" (case-insensitive), "hr" (case-insensitive), "embed" (case-insensitive), "command" (case-insensitive), "col" (case-insensitive), "br" (case-insensitive), "base" (case-insensitive), "area" (case-insensitive), "svg", "style", or "script"
I'd expect this syntax to be supported rather than throwing an error.
This syntax existed in older versions of the Dawn theme (example), although the theme has now been changed to work around it. This is how the issue presents in the theme editor:
Reproducible with:
- Shopify theme editor
- Programmatic use of @shopify/liquid-html-parser
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 with the @shopify/liquid-html-parser package and reproduce the reported dynamic-tag example. Trace how the parser handles the opening and closing tags, then verify that the snippet is accepted without a LiquidHTMLSyntaxError and that existing parsing behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100