【问题标题】:Syntax highlighting not working for Julia in Jekyll websiteJekyll 网站中的语法突出显示不适用于 Julia
【发布时间】:2017-01-29 13:30:48
【问题描述】:

我将 Jekyll 与 Github Pages 一起使用,但在我的网站上显示具有正确语法突出显示的 Julia 代码时遇到问题。

这是我的博文:

---
layout: post
title: 'Example post'
---

Here the highlighting works:

{% highlight python %}
# Python
x = 9

for i in range(1, 11):
    y = sqrt(x) - i
    print(y)
{% endhighlight %}

Here it doesn't:

{% highlight julia %}
# Julia 
x = 9

for i = 1:10
    y = sqrt(x) - i
    println(y)
end
{% endhighlight %}

当我使用 bundle exec jekyll serve --drafts 在本地运行 Jekyll 时,会产生以下内容(屏幕截图):

read 应该支持 Julia,所以我不确定可能出了什么问题。

我的config_yml 看起来像这样:

# Permalinks
permalink: pretty

# Setup
title: MyTitle
url: http://mywebsite.github.io
description: "Hello, I'm me."
paginate: 4
baseurl: ""

# Assets
# We specify the directory for Jekyll so we can use @imports.
sass:
  sass_dir: _sass
  style: :compressed

# About/contact
author:
  name: Firstname Surname
  email: hi@me.com

# Custom vars
version: 2.0.0
github:
  repo: https://github.com/poole/poole

# Gems
gems:
  - jekyll-paginate
  - jekyll-gist

pages_list:       
  FistPage: '/FirstPage'
  SecondPage: '/SecondPage'

encoding: utf-8

# Choose Markdown version
markdown: kramdown

任何关于我如何使它工作的想法都将不胜感激。

【问题讨论】:

  • 您显示支持 Julia 的链接已过期。从版本 3 Jekyll uses Rouge for highlighting 开始,而不是 Pygments。但无论如何Julia should be supported by Rouge。您是否尝试过推送到 GitHub 以查看它是否在那里工作?你在本地有哪些版本的 Jekyll 和 Rouge?
  • 查看answer,我在其中解释了如何以一般方式使突出显示为 jekyll 工作。我认为您可以根据自己的情况进行调整。
  • 当我推送到 Github 时,它确实可以正确构建,并且 Julia 也有正确的语法突出显示。我正在使用 Jekyll 3.0.3,但我不知道如何检查 Rouge 版本。我怀疑我的本地 ruby​​+ jekyll + gems + bundler 安装可能不正确。
  • 我认为克里斯已经回答了,但如果您仍需要帮助,请在评论中提及我的名字,以便我收到通知 @ulima2_

标签: markdown jekyll julia syntax-highlighting github-pages


【解决方案1】:

您的本地 gem 似乎需要更新。 Jekyll 最新版本is currently 3.4.0

作为described in their documentation,你可以通过运行更新 Jekyll

gem update jekyll

尝试运行

gem oudated

查看 Rouge(和其他宝石)是否也需要更新。

【讨论】:

  • 我使用了这两个命令和gem update 来更新它们,但问题仍然存在。
  • @ulima2_,你是如何安装 Jekyll 的?你在什么操作系统上?
  • OS X 10.11.6。我不熟悉 Ruby,我只是使用所有这些来管理我的网站。去年四月我第一次安装了 Jekyll 以及 bundler 和 gems 等相关软件。我浏览了 Github 和 Jekyll 教程来安装它,结果很好。我记得几个月前 Jekyll 遇到了一些麻烦(我想我当时更新了我的操作系统)并四处搜索解决方案。我使用了一些我在 Stackoverflow 上找到的命令行魔法,我认为一切都恢复正常了。所以现在我不完全确定安装的方式和位置。
  • 我应该补充一点,当我在 Windows 7 机器上使用 Jekyll 本地构建站点时,我遇到了完全相同的问题(没有 Julia 语法突出显示)。 @yaitloutou 有什么想法吗?
  • @ulima2_,我们已经走到了我能提供帮助的边缘。我不是 OSX 用户,也不是 Ruby 高级用户。你的项目目录中有Gemfile 吗?我很想告诉你完全删除 Ruby 和所有库(包括 Jekyll 和 Rouge)并在系统范围内重新安装它们……
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-01-05
  • 2023-03-08
  • 1970-01-01
相关资源
最近更新 更多