Jekyll指出Liquid Exception:documentation.html中的US-ASCII字节序列无效 [英] Jekyll says Liquid Exception: invalid byte sequence in US-ASCII in documentation.html

查看:105
本文介绍了Jekyll指出Liquid Exception:documentation.html中的US-ASCII字节序列无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在GitLab CI上运行jekyll build.

I'm trying to run jekyll build on GitLab CI.

这是我的.gitlab-ci.yml:

pages:
  script:
  - export LC_ALL=en_US.UTF-8
  - export LANG=en_US.UTF-8
  - gem install jekyll
  - jekyll build --destination public
  artifacts:
    paths:
    - public

任务运行时出现此错误:

When the task runs I get this error:

      Generating... 
  Liquid Exception: invalid byte sequence in US-ASCII in documentation.html
jekyll 3.1.2 | Error:  invalid byte sequence in US-ASCII

ERROR: Build failed with: exit code 1


更多信息

documentation.html是:


More informations

documentation.html is:

---
layout: page
title: Documentation
description: Learn how to create awesome poppers
---
<!-- This page is generated by the grunt doc task of the master branch! Don't edit it! -->
{% markdown documentation.md %}

documentation.mdgrunt-jsdoc2md生成的降价文档.

这是我正在使用的markdown插件:

This is the markdown plugin I'm using:

=begin
  Jekyll tag to include Markdown text from _includes directory preprocessing with Liquid.
  Usage:
    {% markdown <filename> %}
  Dependency:
    - kramdown
=end
module Jekyll
  class MarkdownTag < Liquid::Tag
    def initialize(tag_name, text, tokens)
      super
      @text = text.strip
    end
    require "kramdown"
    def render(context)
      tmpl = File.read File.join Dir.pwd, "_includes", @text
      site = context.registers[:site]
      tmpl = (Liquid::Template.parse tmpl).render site.site_payload
      html = Kramdown::Document.new(tmpl).to_html
    end
  end
end
Liquid::Template.register_tag('markdown', Jekyll::MarkdownTag)


尝试

如您所见,我已经尝试将LC_ALLLANG设置为en_US.UTF-8.


Attempts

As you see, I've already tried setting LC_ALL and LANG to en_US.UTF-8.

我还在_config.yml中添加了encoding: utf-8,但仍然无法正常工作...

I've also added encoding: utf-8 to my _config.yml but it still doesn't work...

另一种尝试是在markdown插件中使用@text = text.encode("iso-8859-1").force_encoding("utf-8").strip.

Another attempt was to use @text = text.encode("iso-8859-1").force_encoding("utf-8").strip in the markdown plugin.

建议?

推荐答案

我删除了markdown插件并使用了它:

I deleted the markdown plugin and used this:

---
layout: page
title: Documentation
description: Learn how to create awesome poppers
---
<!-- This page is generated by the grunt doc task of the master branch! Don't edit it! -->
{% capture documentation %}
{% include documentation.md %}
{% endcapture %}
{{ documentation | markdownify }}

一切似乎都正常了.

这篇关于Jekyll指出Liquid Exception:documentation.html中的US-ASCII字节序列无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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