jekyll 2.0.3 Error: undefined method `pygments_prefix' for #<Jekyll::Converters::Identity> - jekyll

I am trying to jekyll serve a website that was created with a previous version of jekyll.
I had to update my _config.yml file from this:
#Build settings
markdown: rdiscount
pygments: true
paginate: 100
permalink: pretty
To this:
#Build settings
markdown: rdiscount
highlighter: pygments
paginate: 100
permalink: pretty
This should be OK but I get the following error when I try to serve the application.
jekyll 2.0.3 Error: undefined method `pygments_prefix' for #<Jekyll::Converters::Identity>`
Any help on that? Thank you

According to my experience with the very same problem, this function and its `suffix' sibling have been renamed to highlighter_prefix and highlighter_suffix in Jekyll 2.0.3.
This is probably caused by one of your plugins, grep them out and replace them and things might just work.
Good luck!

Related

Jekyll not serving with drafts option

Jekyll is not serving when I use the --drafts flag. I get the following error:
[2017-02-11 15:49:48] ERROR `/files/' not found
It works fine when I don't call --drafts.
So, this works:
jekyll serve --watch --baseurl ""
But this doesn't:
jekyll serve --watch --baseurl --drafts ""
I have also tried removing all else, so it is just:
jekyll serve --drafts
I have a draft post in my _drafts directory, which is marked with draft: true (I have also tried published: false and leaving that out entirely.
The contents of _config.yml are:
baseurl: /blog
exclude: ['README.md']
permalink: pretty
# Conversion
markdown: kramdown
highlighter: rouge
# Markdown Processors
kramdown:
input: GFM
auto_ids: true
syntax_highlighter: rouge
It might be worth noting that syntax highlighting isn't working either, so the errors may (or may not) be related.

gh-pages with static html can't access file when it exists

The index.html home page displays fine, however any any link will throw a 404.
The static website has folder with html in it, index link to these html with the correct path, but displays a 404.
When clicking on this link, I got a 404.
however the file is present as you can see here .
I am really banging my head on a simple html pb, which is frustrating.
I ran into this problem myself and finally discovered a simpler solution. The problem is that Jekyll ignores all files that start with _. The simple solution is to add a .nojekyll file to your docs dir.
My docs script looks like this:
"rimraf ./docs && typedoc src/ --out docs --mode modules --module commonjs --target es6 --excludePrivate && touch ./docs/.nojekyll && gh-pages -d docs -t"
touch is an npm module that creates the file and the -t flag on gh-pages is necessary to have that dot file uploaded.
Alright I though I might just answer my own question here.
Github Page doesn't allow several static HTML files.
This is not very clear to be honest on their docs, but the solution is quite simple :
Assuming your local static docs works correctly, just follow these steps :
install jekyll
gem install jekyll bundler
add a file _config.yml
in your docs or on the root of your gh-pages branch with this content:
auto: true
execute jekyll serve
And test if this works ok on the url outputed in your console
add _site in your .gitignore
push and bingo!
If you are like me using typedoc to compile typescript into nice documentation, you will run into trouble.
Because Jekyll automatically exclude from the build any files starting with _, and typedoc generates ONLY that, I wrote a simple yeoman generator that does all the replacement for you.

Kramdown backticks not recognized in GFM mode

I'm trying to get some very simple pages to render properly with Jekyll using kramdown to process markdown and rouge for syntax highlighting. Kramdown appears to not interpret triple-backticks, however, even in GFM mode.
I believe I've followed the instructions to the letter, and things work out fine when pushed to github pages, but my local setup just ignores the backticks.
If it's any help, this has been observed on OS X with Jekyll 3.1.1. The command line used to invoke jekyll is jekyll serve --config "_config.yml".
I've narrowed the problem to the following minimal test:
_config.yml
markdown: kramdown
highlighter: rouge
kramdown:
input: GFM
index.md
---
layout: default
---
```scala
def test(i: Int): Unit = {
println(i)
}
```
layout/default.html
<!doctype html>
<html>
<body>{{ content }}</body>
</html>
Resulting index.html
<!doctype html>
<html>
<body><p>```scala
def test(i: Int): Unit = {
println(i)
}</p>
<p>```</p>
</body>
</html>
I suggest you to do like this. I tested your code block whit the following configuration and it worked fine:
config.yml :
highlighter: rouge
markdown: kramdown
kramdown:
input: GFM
Then, to your file index.md:
```scala
def test(i: Int): Unit = {
println(i)
}
```
Note: I've noticed that there was a space before ```scala and it shouldn't be there.
Then, run jekyll serve with bundler:
Open your terminal and:
Install bundler:
gem install bundler
Update all your gems (if you want):
bundle update
Add a Gemfile (don't add any file extension) to your site root and paste the code below into it. This is GitHub Pages recommended method.
source 'https://rubygems.org'
gem 'github-pages'
Go to your project root folder (on the terminal) and run:
bundle install (this will make sure you have all required gems and their dependencies installed locally). A Gemfile.lock will be generated for you at your site root. Leave it there.
Run bundle exec jekyll serve --watch to view your site locally at http://localhost:4000
Done!
Let me know if this works for you, yeah?

Run jekyll build Command with Different url Flag

My current _config.yml file looks like this:
#Site settings
...
baseurl: "" # the subpath of your site, e.g. /blog/
url: "http://10.0.1.9:3000" # the base hostname & protocol for your site
...
# Build settings
markdown: kramdown
safe: true
lsi: false
highlighter: true
keep_files: [public]
exclude: [src, lib, node_modules, bower.json, Gemfile, gulpfile.js, package.json, README.md]
I've got my url currently set to my local server, where I serve my Jekyll site for local development.
When building for production however, I have to keep manually changing this url to the url of my remote server before running jekyll build. Is there a way I can pass my remote url alongside the jekyll build command to build a site with the correct remote paths?
Something like so:
jekyll build --url mysite.com
Any help is appreciated with this. Thanks in advance!
Put your production url in _config.yml eg: url: toto.com.
Create a _config_dev.yml that will be used to override values in development.
In you case
url: "http://10.0.1.9:3000"
Development build is launched with :
jekyll build --config _config.yml,_config_dev.yml
Values in the last config file in the command will override those in first file.
and production build with jekyll build.
See Jekyll documentation http://jekyllrb.com/docs/configuration/#build-command-options configuration paragraphe.

Adding Jekyll to an existing website

I have a simple website and tried to add a Jekyll blog in it in a new folder blog thus I have run jekyll new blog in the folder /path. However when I'm running the command jekyll build in /path I have these errors:
$ jekyll build
Configuration file: none
Source: /path
Destination: /path/_site
Generating...
Build Warning: Layout 'post' requested in blog/_posts/2015-06-14-welcome-to-jekyll.markdown does not exist.
Build Warning: Layout 'default' requested in blog/index.html does not exist.
Conversion error: Jekyll::Converters::Scss encountered an error converting 'blog/css/main.scss'.
Conversion error: File to import not found or unreadable: /blog/_sass/base.scss. Load paths: on line 47
I solved the first problem (Configuration file: none) by moving _config.ymlin the parent folder, however I still have problems when requesting layout using
---
layout: default
---
The imports in main.scssare also not working (last error).
If I'm doing the same command jekyll build in /path/blogafter moving again _config.yml, I have no errors. Does someone know how to be able to do a jekyll buildin the parent folder with the configuration I have? Do I have to entirely change the architecture of my website to include a Jekyll blog in it?
You config.yml is in /path with
source: /_jekyll
destination: /blog
baseurl: /blog
Your jekyll sources are in /path/_jekyll.
And you generated files will be in /path/blog.
Ready to deploy !