Jekyll的漂亮打印html输出 [英] Pretty print html output from Jekyll

查看:93
本文介绍了Jekyll的漂亮打印html输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以漂亮地打印Jekyll的html输出吗?

Is there any way to pretty print html output from Jekyll?

例如,以下是Jekyll生成的html代码段.请注意<p>标记如何没有缩进并且在它们之后没有不必要的换行符.

For example, below is a snippet of html that Jekyll generates. Notice how the <p> tags have no indentation and have unnecessary line breaks after them.

      ...
      <div id="content">

<p class="flush">Post 1</p>

<p class="flush">Post 2</p>

<p class="flush">Post 3</p>


      </div>
      ...

我正在想象一个选项或插件,它会像这样打印:

I'm imagining an option or plugin that would pretty print like this instead:

      ...
      <div id="content">
        <p class="flush">Post 1</p>
        <p class="flush">Post 2</p>
        <p class="flush">Post 3</p>
      </div>
      ...

推荐答案

我建议您选择

I would suggest you to choose one of tidy-makers and write your own :tidy task in the end of jekyll-specific task chain. Or, even easier:

desc "Tidy jekyll output"
task :tidy do
  `find _site -name "*.html" -exec tidy {} \;`
end

请注意,您的新创建的任务或任何可能在Internet上找到的插件都不会应用于 github页面,因为它们限制了运行jekyll的策略.

Please note, that neither your newly created task nor any plugin that probably may be found over the internet will not be applied on github pages, since they have restricted policies to run jekyll.

这篇关于Jekyll的漂亮打印html输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆