有没有办法修复 </a>
标签缩进 link_to
helper ?
在我的 .html.erb 中:
<%= link_to... do %>
...
<% end %>
在呈现的 .html 中:
<a href="..">
</a><!--fails to inherit the indentation-->
IDE 中的 2 个空格缩进:
Chrome 的 view-source:*
:
最佳答案
这仍然是有效的 HTML,因此您可以忽略它。
这取决于 ERB(由 Rails 中的 erubis 提供支持)如何处理将插入呈现文本的字符串缓冲区中的前导和尾随空格。
你可以试试<%= -%>
.还有 check this question为了区别。
关于html - ERB/Rails 中关闭 </a> 标记的正确缩进,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28597280/