Request: More lenient parsing (Error: unknown block tag: match
)
#63
Labels
bug
Something isn't working
Error: unknown block tag: match
)
#63
Description
This plugin is currently the only thing the many jinja-style template users can use to be able to stick with prettier.
In my case, I want to use it to format my templates for askama. Askama supports
{% match %}
, but this plugin chokes on that.Askama
match
:https://djc.github.io/askama/template_syntax.html#match
Expected behavior
The plugin formats this properly, as it understands
{% %}
and hopefully does not need to care much about what's inside the jinja expression.At
default
(block parsing fallthrough) https://github.com/HubSpot/prettier-plugin-hubl/blob/master/parser/src/parser/parser.js#L790 I would expect the parser to parse the block as unknown kind, and preserve its block tags, while formatting its child nodes as usual.Instead, it fails hard: https://github.com/HubSpot/prettier-plugin-hubl/blob/master/parser/src/parser/parser.js#L799 - which seems unnecessary.
Of course the 🥇 would be if a
parseMatch()
method was to be added to the parser. :)To Reproduce
Original Source Code:
Error:
Additional context
I am using helix editor, configured to invoke prettier with
--parser hubl
and--plugin-search-dir /path/to/.local/share/pnpm/global/5/
.Askama
match
examples can be found at https://github.com/djc/askama/tree/main/testing/templates - all template files starting withmatch
.Direct link to the error site:
prettier-plugin-hubl/parser/src/parser/parser.js
Lines 754 to 803 in f558aec
Checklist
The text was updated successfully, but these errors were encountered: