首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Hakyll生成奇怪的HTML --有人能解释原因吗?

Hakyll生成奇怪的HTML --有人能解释原因吗?
EN

Stack Overflow用户
提问于 2010-10-09 01:55:33
回答 3查看 421关注 0票数 5

我使用Hakyll生成一些文档,我注意到它在生成的代码中有一种奇怪的关闭HTML标记的方式。

有一个页面,他们说你必须像他们一样生成标记,否则你页面的布局在某些情况下会被破坏,但我现在找不到它。

我创建了一个小的测试页面(下面的代码),它有一个红色的层和一个黄色的层,红色层具有“普通”HTML标记,黄色层具有类似于hakyll生成的标记。

我在Firefox中看不到这两个div之间的任何区别。

谁能解释他们说的是不是真的?

代码语言:javascript
复制
<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>
EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2010-10-09 02:10:24

实际上是pandoc生成了HTML代码。在Pandoc问题跟踪器中有一个很好的解释:

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

这是因为

标签之间的任何空白(包括换行符和制表符)都会导致浏览器在这些元素之间插入一个空格字符。在机器逻辑上省略这些空格要容易得多,因为这样您就不需要考虑浏览器添加额外空格可能会导致HTML文本格式混乱的可能方式。

票数 5
EN

Stack Overflow用户

发布于 2010-10-09 01:59:57

有时,剥离两个标记之间的空白会产生影响,特别是在处理内联元素时。

票数 0
EN

Stack Overflow用户

发布于 2012-01-03 07:10:56

我整齐地跑过它,它修复了不寻常的换行符。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3893038

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档