我使用Hakyll生成一些文档,我注意到它在生成的代码中有一种奇怪的关闭HTML标记的方式。
有一个页面,他们说你必须像他们一样生成标记,否则你页面的布局在某些情况下会被破坏,但我现在找不到它。
我创建了一个小的测试页面(下面的代码),它有一个红色的层和一个黄色的层,红色层具有“普通”HTML标记,黄色层具有类似于hakyll生成的标记。
我在Firefox中看不到这两个div之间的任何区别。
谁能解释他们说的是不是真的?
<html>
<body>
<!-- NORMAL STYLE -->
<div style="background: red">
<p>Make available the code from the library you added to your application. Again, the way to do this varies between languages (from adding import statements in python to adding a jar to the classpath for java)</p>
<p>Create an instance of the client and, in your code, make calls to it through this instance's methods.</p>
</div>
<!-- HAKYLL STYLE -->
<div style="background: yellow"
><p
>Make available the code from the library you added to your application. Again, the way to do this varies between languages (from adding import statements in python to adding a jar to the classpath for java)</p
><p
>Create an instance of the client and, in your code, make calls to it through this instance's methods.</p
></div
>
</body>
<html>发布于 2010-10-09 02:10:24
实际上是pandoc生成了HTML代码。在Pandoc问题跟踪器中有一个很好的解释:
http://code.google.com/p/pandoc/issues/detail?id=134
这是因为
标签之间的任何空白(包括换行符和制表符)都会导致浏览器在这些元素之间插入一个空格字符。在机器逻辑上省略这些空格要容易得多,因为这样您就不需要考虑浏览器添加额外空格可能会导致HTML文本格式混乱的可能方式。
发布于 2010-10-09 01:59:57
有时,剥离两个标记之间的空白会产生影响,特别是在处理内联元素时。
发布于 2012-01-03 07:10:56
我整齐地跑过它,它修复了不寻常的换行符。
https://stackoverflow.com/questions/3893038
复制相似问题