我正试图jekyll build在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
Run Code Online (Sandbox Code Playgroud)
当任务运行时,我收到此错误:
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
Run Code Online (Sandbox Code Playgroud)
documentation.html 是:
---
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 %}
Run Code Online (Sandbox Code Playgroud)
并且documentation.md是由生成的降价文档grunt-jsdoc2md.
这是markdown我正在使用的插件:
=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)
Run Code Online (Sandbox Code Playgroud)
正如你看到的,我已经尝试设置LC_ALL和LANG到en_US.UTF-8.
我也加入encoding: utf-8了我的_config.yml但仍然无效......
另一种尝试是@text = text.encode("iso-8859-1").force_encoding("utf-8").strip在markdown插件中使用.
建议?
我有同样的问题,并找到了这个解决方案,这对我有用. https://gitlab.com/gitlab-org/gitlab-ce/issues/14983
image: ruby:2.3
before_script:
- apt-get update >/dev/null
- apt-get install -y locales >/dev/null
- echo "en_US UTF-8" > /etc/locale.gen
- locale-gen en_US.UTF-8
- export LANG=en_US.UTF-8
- export LANGUAGE=en_US:en
- export LC_ALL=en_US.UTF-8
Run Code Online (Sandbox Code Playgroud)
我删除了 markdown 插件并使用了这个:
---
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 }}
Run Code Online (Sandbox Code Playgroud)
现在一切似乎都运转良好。
| 归档时间: |
|
| 查看次数: |
1035 次 |
| 最近记录: |