beautifier/js-beautify
在 GitHub 查看Handlebars {{#tr}} helper is indented as if it were a <tr> tag
Open
#2,045 创建于 2022年4月13日
good first issuelanguage: htmltype: bug
仓库指标
- Star
- (8,342 star)
- PR 合并指标
- (平均合并 51天 1小时) (30 天内合并 16 个 PR)
描述
Description
Zulip defines a custom Handlebars helper {{#tr}} for translation, but when it happens to be used inside a table cell, js-beautify seemingly confuses it with a <tr> (table row) tag and indents it at the wrong level.
Input
The code looked like this before beautification:
<table>
<tr>
<td>
{{#tr}}translated{{/tr}}
</td>
</tr>
</table>
Expected Output
The code should have looked like this after beautification:
<table>
<tr>
<td>
{{#tr}}translated{{/tr}}
</td>
</tr>
</table>
Actual Output
The code actually looked like this after beautification:
<table>
<tr>
<td>
{{#tr}}translated{{/tr}}
</td>
</tr>
</table>
Steps to Reproduce
html-beautify -H test.hbs
Environment
OS: Linux
Settings
None