Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

当一行有多个标签时,格式后格式错乱 #12

Open
lhajh opened this issue Nov 22, 2018 · 5 comments
Open

当一行有多个标签时,格式后格式错乱 #12

lhajh opened this issue Nov 22, 2018 · 5 comments
Labels
bug Something isn't working

Comments

@lhajh
Copy link

lhajh commented Nov 22, 2018

Describe the bug [描述]:

格式前:

<p class="a" title="ggg"><span class="d" title="fdf"><span class="gg" title="gbfd">fdf</span></span></p>

格式后:

<p
  class="a"
  title="ggg"><span
class="d"
title="fdf"><span
class="gg"
title="gbfd">fdf</span></span></p>
@win7killer win7killer added the bug Something isn't working label Nov 22, 2018
@win7killer
Copy link
Owner

@lhajh 捋了捋,发现这种情况有点难受~需要有较大改动
暂时先关闭 attr_end_with_gt 配置使用;或者暂时关闭html格式化

@win7killer
Copy link
Owner

@lhajh 在 0.1.5 中使用优化方案来处理
issues#12
取消对 js-beautify 中 html.unformatted 标签的 属性断行【例如,span 标签,不在对其attrs 做断行处理,inline标签不作任何处理。如需格式化对应标签,可在 vue-format.js-beautify.html.force_format 中添加对应标签名,如“template”】

@lhajh
Copy link
Author

lhajh commented Nov 26, 2018

@win7killer 喵?喵?喵?意思就是说现在只格式块元素?如果需要格式化 inline 标签,需要添加到 vue-format.js-beautify.html.force_format 中?我把 span 添加进去以后,还是出现上面的问题

那就是说这个问题暂时解决不了,先规避掉吗?

@win7killer
Copy link
Owner

win7killer commented Nov 26, 2018

@lhajh 按照 js-beautify 对 html 格式化的策略来说,对于 unformatted 的标签时不做任何处理的。
我这边用的方案暂时是解决不了,所以受影响的就是 unformatted 的标签,不会对 attrs 断行处理。

回头找到合适方案的话,会同步的~

@lhajh
Copy link
Author

lhajh commented Nov 26, 2018

@win7killer 👌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants