2012-03-22 45 views
1

如果您访问我的网站,您会注意到最近的文章(在主页上)标题包裹在<pre>标记中,并重复。我不知道为什么会发生这种情况。Github页面添加随机标签到我的帖子

这里是正在显示的帖子:

--- 
layout: default 
--- 

Stop distributing .doc files 
---------------------------- 
Monday March 19th, 2012 

`.doc` started as a file format used by many operating systems and used to store only plain-text. In the 90's, Microsoft decided to use the extension for Word -- their new word processor. Not only did they decide to use the extension, but they also broke the standard by using a proprietary format, instead of the plain-text most people were used to. Despite the `.doc` extension being more than **10 years old** and the fact that most documents formatted this way render horribly in operating systems other than Windows, I still regularly receive documents in this format. Stop it. 

However aggravating the above paragraph is, this article isn't solely targeted at the `.doc` extension -- it is a public plea for people to stop distributing application specific documents and to start distrubting all documents in `.pdf`. 

Yesterday I received an email from an engineering society I'm a part of. They were notifying all members of the upcoming annual general meeting that is taking place next week. I immediately lost interest in the email when I saw that their meeting schedule and their nomination form were both in `.docx` format. I don't like being forced to download the file, minimize my browser, launch an Office application (in my case, LibreOffice) and then read the content. Had it been distributed in `.pdf`, Chrome would have immediately opened a new tab for me displaying the document and giving me options to save, zoom or print it. I'm sure Firefox, Opera and (maybe) Internet Explorer have similar features. 

We are increasingly collaborating on the web, and the need for bulky desktop applications are almost gone with the wind. Had I not had an office application on my computer (which could have been possible seeing as I do most of my documentation and report with LaTeX), I would have had an extra step before viewing the content that was sent to me. It's not like it is difficult either. All major office applications I know of allow easy exporting to `.pdf` file format and LibreOffice also allows you to save a hybrid `.pdf` and `.odt` together in one file. This allows you to distribute the PDF as is and also open it for editing. 

There is virtually no need to distribute documents in any format, proprietary or not, other than PDF. Don't make your users work and fiddle with your flatform-specific or application-dependent documents. 

这里是我的默认布局(相关部分,您可以查看任何其他来源):

<div id="right-side"> 

      {{ content }} 

      <div id="footer"> 
       <p> 
        &copy; {{ site.author.name }} 2012 with help from 
        <a href="http://jekyllbootstrap.com" target="_blank">Jekyll Bootstrap</a> 
       </p> 
      </div> 
     </div> 

你可以看到,布局只是简单地转储right-side div中的降价文件的内容。如果您访问我的网站上的其他页面/帖子,您会看到这些页面可以正常工作,但不是主页(尽管它们处于相同的标记格式并使用相同的布局)。

任何想法?

+0

我没有看到它? (是[这个页面](http://maxmackie.com/2012/03/19/Stop-distributing-.doc-files/)?) – huon 2012-03-22 23:42:51

+0

@dbaupp,http://maxmackie.com/是页面工作不正常。您链接到的页面是同一篇文章,但它正常工作(因为它不在主页上) – n0pe 2012-03-23 01:25:14

回答

2

问题是在your index page上的循环。缩进(有点)由Liquid保存:文本替换是一个文字替换,它意味着第一行将缩进,但后面的行不会缩进。 index.mdfirst.content已经是HTML)的降格处理发生在Liquid运行后,所以缩进被解释为代码块。

在处理中的步骤(这不一定在每一步逐字输出,但是这将是接近):

{% for first in site.posts limit:1 %} 
    {{ first.title }} 
    {{ first.content }} 
{% endfor %} 

之后有液体运行index.md

Stop distributing .doc files 
    <h2>[...]</h2> 

<p>Monday March 19th, 2012</p> 

[...] 

现在Markdown运行,并且缩进意味着前两行是代码块:

<pre><code>Stop Distributing .doc Files 
&lt;h2 id='stop_distributing_doc_files'&gt;Stop distributing .doc files&lt;/h2&gt;</code></pre> 
<p>Monday March 19th, 2012</p> 

这可以通过没有如此大的缩进for循环的元素来解决:使用4个空格或制表符缩进代码块。所以

{% for first in site.posts limit:1 %} 
    {{ first.title }} 
    {{ first.content }} 
{% endfor %} 
+0

非常感谢!这工作完美。你有一个敏锐的眼睛,考虑自己在Github上。 – n0pe 2012-03-23 03:24:23

+0

@MaxMackie不是问题:)(我遇到过类似的问题,所以我知道我在找什么) – huon 2012-03-23 03:29:32

+0

@dbaupp另一个解决方案是使用'{{first。'来标记循环内的内容。内容| markdownify}}'? – 2014-01-03 23:23:03