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?
Related
I'm having a heck of a time figuring out how to get Jekyll (v4.0.0) to minify javascript. I have installed jekyll-assets (v3.0.12) and jekyll-minifier (v0.1.10) in an effort to do so, but no luck so far... the javascript remains unminified.
I've tried a number of configuration options in _config.yml that didn't help, referencing the documentation here:
https://github.com/envygeeks/jekyll-assets/tree/v3.0-current#configuration
Any help would be greatly appreciated!
Gemfile
# frozen_string_literal: true
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
# gem "rails"
gem "jekyll", "~> 4.0"
group :jekyll_plugins do
gem "jekyll-assets"
gem "jekyll-minifier"
end
_config.yml
permalink: pretty
sass:
style: compressed
exclude:
- gulpfile.js
- node_modules
- CNAME
- README
- '*.json'
- .DS_Store
plugins:
- jekyll-assets
- jekyll-minifier
assets:
sources:
- "css"
- "js"
_includes/scripts.html
...
{% javascript app %}
...
js/app.js
//=require scripts.js
//=require scripts-2.js
var myStr = "app";
myStr += " js";
console.log(myStr);
command line
JEKYLL_ENV=production bundle exec jekyll build
The Jekyll-Minifier plugin may be minifying javascript in the _site directory after Jekyll creates the static site. If you are using github pages, this won't work as Github is building from the source and has limited plugin support. You may have to build using the plugin and use the _site directory to serve manually, or find a different plugin that minimizes in place rather than in the _site directory.
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.
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.
I have been using Jekyll for my blog and it has been working fine. Now I am trying to add new posts from a computer running Ubuntu 14.04 and Jekyll 2.4.0. The problem is that, only on this computer, it does not generate index.html in _site.
I can't find anything in the documentation that helps, and in any event, I'm using git so I have the same configuration on all of my machines.
So the question is: How does one turn off generation of index.html in Jekyll, and how can it be turned back on?
[Update: I did gem uninstall jekyll followed by gem install jekyll, rebuilt the site, and everything works fine. The original install must not have completed properly.]
To turn generation off you can remove this file. Or to use static index.html file remove markdown section enclosed with double triple --- in header (in this case static index.html will be parsed). Also mention filename it in exclude: section of _config.yml to avoid copying to _site folder.
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!