html formatter doesn't support handlebars partial blocks (`#>`)
See original GitHub issueDescription
The handlebars support in the HTML beautifier is incomplete and doesn’t account for partial blocks. (as documented here: https://handlebarsjs.com/guide/partials.html#partial-blocks)
Input
The code looked like this before beautification:
{{#>row}}
{{#>column}}
<span>content</span>
{{/column}}
{{/row}}
Expected Output
The code should have looked like this after beautification:
{{#>row}}
{{#>column}}
<span>content</span>
{{/column}}
{{/row}}
Actual Output
The code actually looked like this after beautification:
{{#>row}}
{{#>column}}
<span>content</span>
{{/column}}
{{/row}}
Steps to Reproduce
Environment
OS: Windows 10 Pro VSCode version: 1.52.0
Settings
{
"html.format.indentHandlebars": true,
"html.format.enable": true,
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
VS Code and Handlebars formatting unable to get partials on ...
From your example, it seems that you are using HTML Language Features as the formatter. Try setting this in your VS Code settings.json...
Read more >Using Inline Partials and Decorators with Handlebars 4.0
Partials are a common templating concept not unique to Handlebars. The idea behind it is to create templates that are likely to be...
Read more >Expressions | Handlebars
Handlebars expressions are the basic unit of a Handlebars template. You can use them alone in a {{mustache}} , pass them to a...
Read more >Personalizing Templates with Handlebars
If the HTML-containing parameter comes from a data feed (and you have not merged ... Iterable message templates use Handlebars helpers and block...
Read more >Handlebars
getHTML(), template = Y.Handlebars.compile(source), html; // Render the template to ... It doesn't support comparisons or logical operators like && and || ....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I can work on this issue and will update you with any changes!
@Goobles
It is likely that the version inside vscode is out of date, so it is probably missing some fixes.
The space fixing the issue comes from here: https://github.com/beautify-web/js-beautify/blob/5bfad82226f98a5f6543fbde96e479e6763fd3cd/js/src/html/tokenizer.js#L71
The earlier code segment expects there to be two separate tokens for the start of the block the
{{#>
and the word following. So, we need some combination of fixes between the two.I won’t have time to work on this any time soon, but PRs are welcome.