我使用hakyll生成一些文档,我注意到它具有关闭其生成代码中HTML标签的怪异方法。

他们说您必须像这样生成标记,或者在某些条件下您的页面布局会被打破,但我现在找不到它。

我创建了一个小测试页面(下面的代码),该页面带有一个红色层,上面有“正常” HTML标记,并且具有与Hakyll生成的相似的标记层。

我看不到两个divs之间的Firefox有任何区别。

有人可以解释他们说的是真的吗?

<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>
有帮助吗?

解决方案

实际上是 潘多克 这就是生成HTML代码。 Pandoc问题跟踪器中有一个很好的解释:

http://code.google.com/p/pandoc/issues/detail?id=134

原因是因为HTML标签之间的任何空格(包括newline和Tabs)都会导致浏览器在这些元素之间插入空格字符。在机器逻辑上,将这些空间排除在外要容易得多,因为这样您就无需考虑HTML文本格式可能会与浏览器添加额外空间混乱的可能方式。

其他提示

有时候,在两个标签之间剥离空白会有所作为,尤其是在处理内联元素时。

我对它进行了整洁,它固定了异常的线路破坏。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top