ASP.NET MVC“整洁”动态 HTML
我想知道是否有任何类型的工具可以在 Tidy Html飞。
目前在我的应用程序中,我使用母版页,然后我的视图加载到母版页中。问题是
总是在输出 HTML 中添加额外的空格/换行符。
我真正想做的就是清理它,这样
<title>
This is my title
</title>
看起来就像
<title>This is my title</title>
现在我意识到我可以遍历并设置
<asp:content ID="Content1" runat="server" ContentPlaceHolderID="TitleContent">This is my title</asp:content>
但这变得很痛苦,因为我经常使用 Ctrl + k< /kbd> + d 这会导致不希望的重新格式化。
此外,当我使用内联代码
<asp:Content ID="indexTitle" ContentPlaceHolderID="TitleContent" runat="server">User <%: Model.UserName%> - Urban Now</asp:Content>
并使用“重新格式化”击键时,在 <%: Model.UserName%>
之前和之后也有换行符,并且无法在“工具/选项/格式 --> 标记特定选项”中设置格式(至少我找不到)。
I'm wondering if there's any kind of tool out there to Tidy Html on the fly.
Currently in my app, I use a MasterPage and then my Views are loaded into the Masterpage. The problem is that the <asp:content runat="server" ... />
always adds additional whitespace/linebreaks in the output HTML.
What I'd really like to do is clean it up so that
<title>
This is my title
</title>
will look like
<title>This is my title</title>
Now I realize that I can go through and set
<asp:content ID="Content1" runat="server" ContentPlaceHolderID="TitleContent">This is my title</asp:content>
But that becomes a pain because I often use Ctrl + k + d which results in the reformatting that is undesirable.
Moreover, when I use inline code like
<asp:Content ID="indexTitle" ContentPlaceHolderID="TitleContent" runat="server">User <%: Model.UserName%> - Urban Now</asp:Content>
and use the "reformatting" key strokes, then there are also line breaks before and after the <%: Model.UserName%>
and there is no way to set that formatting in the "Tools/Options/Formatting --> Tag Specific Options" (at least not that I can find).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
TidyManaged 是开源、跨平台 Tidy 库的托管 .NET/Mono 包装器、HTML/XHTML/XML 标记解析器和 HTML/XHTML/XML 标记解析器。清洁剂最初由 Dave Raggett 创建。
示例使用
结果:
请注意,
test</tootle></code> 已更改为正确的 <code><title>test
。https://github.com/markbeaton/TidyManaged
TidyManaged is a managed .NET/Mono wrapper for the open source, cross-platform Tidy library, a HTML/XHTML/XML markup parser & cleaner originally created by Dave Raggett.
Sample Usage
results in:
Please note that
<title>test</tootle>
is changed to the correct<title>test</title>
.https://github.com/markbeaton/TidyManaged