linjer / jekyll-katex Goto Github PK
View Code? Open in Web Editor NEW[DEPRECATED] Jekyll plugin for easy server-side math rendering via KaTeX
License: MIT License
[DEPRECATED] Jekyll plugin for easy server-side math rendering via KaTeX
License: MIT License
KaTeX support line breakers \ and \newline.
But with jekyll-katex, \ rise a error, and \newline is not work too.
Jekyll 4 is released recently and jekyll-katex depends on Jekyll 3.0 thus won't work with the latest version.
Everything is currently manually tested only, however, there's an obvious need to have formal unit and integration tests.
I followed the instructions in the README
group :jekyll_plugins do
gem "github-pages"
gem "jekyll-feed", "~> 0.6"
gem "jekyll-katex", "~> 1.0.0"
end
Using github-pages 200
Using jekyll-katex 1.0.0 (was 0.1.2)
I added the CSS file in my header.
Added {% katexmm %} {{content}} {% endkatexmm %}
in my default.html
.
Inline mode $
with renders great, but display mode with $$
gives me blank.
Any idea what may be up?
There's one line in my blog:
Then I run:
$ jekyll b
Liquid Exception: ParseError: KaTeX parse error: Expected 'EOF', got '&' at position 4: a &̲gt; b in /_layouts/post.html
But if it's
$$
a > b
$$
Ok then.
I'm new to Jekyll, so maybe I'm doing something wrong.
Anyway, I've followed steps 1 and 2 from the readme, and bundle install
goes well (I'm running ruby 2.5.1p57 on a x64 Win 10 machine, with Jekyll 3.8.4).
But then, when I try to run with bundle exec jekyll serve
, I get this:
Configuration file: C:/Users/franc/Documents/GitHub/Einlar.github.io/_config.yml
Katex Configuration: Found KaTeX js at: C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/jekyll-katex-0.3.0/lib/assets/js//katex.min.js
Traceback (most recent call last):
10: from C:/Ruby25-x64/bin/jekyll:23:in `<main>'
9: from C:/Ruby25-x64/bin/jekyll:23:in `load'
8: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/jekyll-3.8.4/exe/jekyll:11:in `<top (required)>'
7: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/jekyll-3.8.4/lib/jekyll/plugin_manager.rb:51:in `require_from_bundler'
6: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.5/lib/bundler.rb:114:in `require'
5: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.5/lib/bundler/runtime.rb:65:in `require'
4: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.5/lib/bundler/runtime.rb:65:in `each'
3: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.5/lib/bundler/runtime.rb:76:in `block in require'
2: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.5/lib/bundler/runtime.rb:76:in `each'
1: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.5/lib/bundler/runtime.rb:80:in `block (2 levels) in require'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.5/lib/bundler/runtime.rb:84:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'jekyll-katex'. (Bundler::GemRequireError)
Gem Load Error is: SyntaxError: Previsto identificatore
Backtrace for gem load error is:
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:39:in `exec'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:14:in `initialize'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/execjs-2.7.0/lib/execjs/runtime.rb:57:in `new'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/execjs-2.7.0/lib/execjs/runtime.rb:57:in `compile'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/execjs-2.7.0/lib/execjs/module.rb:27:in `compile'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/jekyll-katex-0.3.0/lib/jekyll-katex/katex_js.rb:10:in `<module:Katex>'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/jekyll-katex-0.3.0/lib/jekyll-katex/katex_js.rb:9:in `<module:Jekyll>'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/jekyll-katex-0.3.0/lib/jekyll-katex/katex_js.rb:7:in `<top (required)>'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/jekyll-katex-0.3.0/lib/jekyll/tags/katex.rb:4:in `require'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/jekyll-katex-0.3.0/lib/jekyll/tags/katex.rb:4:in `<top (required)>'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/jekyll-katex-0.3.0/lib/jekyll-katex.rb:4:in `require'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/jekyll-katex-0.3.0/lib/jekyll-katex.rb:4:in `<top (required)>'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.5/lib/bundler/runtime.rb:81:in `require'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.5/lib/bundler/runtime.rb:81:in `block (2 levels) in require'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.5/lib/bundler/runtime.rb:76:in `each'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.5/lib/bundler/runtime.rb:76:in `block in require'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.5/lib/bundler/runtime.rb:65:in `each'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.5/lib/bundler/runtime.rb:65:in `require'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.5/lib/bundler.rb:114:in `require'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/jekyll-3.8.4/lib/jekyll/plugin_manager.rb:51:in `require_from_bundler'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/jekyll-3.8.4/exe/jekyll:11:in `<top (required)>'
C:/Ruby25-x64/bin/jekyll:23:in `load'
C:/Ruby25-x64/bin/jekyll:23:in `<main>'
Bundler Error Backtrace:
Adding CSS and fonts as of step 3 does not change the situation. Is this a bug of the plugin or am I doing something wrong?
I tried to write an inline matrix like this:
Some text blah blah $\begin{bmatrix} a & b \\ c & d \end{bmatrix}$
However, the matrix was rendered to this:
[a amp; b c amp; d]
But the same code worked well for a block equation:
$$\begin{bmatrix} a & b \\ c & d \end{bmatrix}$$
Do anyone got any solutions?
In files where I use katex
, I get the following error at compile time:
Warning: Excerpt modified in _posts/2019-07-18-encrypting-secrets-in-memory.md!
Found a Liquid block containing the excerpt separator "\n\n".
The block has been modified with the appropriate closing tag.
Feel free to define a custom excerpt or excerpt_separator in the document's front matter if the generated excerpt is unsatisfactory.
I'm not sure what it's referring to as I have the correct {% katexmm %}
and {% endkatexmm %}
tags at the start and end of the page.
Thanks for making this very useful plugin! I used it locally when writing a post and it rendered perfectly but after uploading the mathematics do not render correctly. I had a similar issue with MathJax so perhaps they are related? My website is being served by Netlify which is sitting behind Cloudflare.
I have followed your instructions:
_config.yml
, e.g.:
plugins:
- jekyll-katex
jekyll-katex
to your Gemfile
plugin block:
group :jekyll_plugins do
gem 'jekyll-katex'
end
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" integrity="sha384-dbVIfZGuN1Yq7/1Ocstc1lUEm+AT+/rCkibIcC/OmWo5f0EA48Vf8CytHzGrSwbQ" crossorigin="anonymous">
but when I use bundle exec jekyll build
the following error appears:
Liquid Exception: Liquid syntax error (line 23): Unknown tag 'katex' in <FILE_PATH>
I am a freshman in front-end field, so could you help me with this problem? Thank you in advance!
Originally motivated by user report #7 .
At version 0.3.0
, ruby-2.5.1
was required but most default installs will be earlier.
Currently the log output shows:
Katex Configuration: Found KaTeX js at: ~/lib/assets/js//katex.min.js
Notice the double slash //
between the :js_path
and the :js_filename
values
Hi, first of all thanks for this plugin and please add support for Jekyll 4.0 :)
and now the actual issue:
I'm building Jekyll in a gitlab ci-cd for 1 project that has two branches: master and development
they have same katex config but in master I get this error
$ bundle info jekyll-katex
* jekyll-katex (0.4.3)
Summary: Jekyll plugin for easy KaTeX math server-side rendering.
Homepage: https://github.com/linjer/jekyll-katex
Path: /usr/local/rvm/gems/ruby-2.6.3/gems/jekyll-katex-0.4.3
$ bundle exec jekyll build -d public
Configuration file: /builds/Azadeh-Afzar/Web-Development/Kianic-Jekyll-Theme/_config.yml
Configuration file: /builds/Azadeh-Afzar/Web-Development/Kianic-Jekyll-Theme/_config.yml
jekyll 3.8.6 | Error: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes.
while on development branch everything runs just fine:
$ bundle info jekyll-katex
* jekyll-katex (0.4.3)
Summary: Jekyll plugin for easy KaTeX math server-side rendering.
Homepage: https://github.com/linjer/jekyll-katex
Path: /usr/local/rvm/gems/ruby-2.6.3/gems/jekyll-katex-0.4.3
$ bundle exec jekyll build -d development
Configuration file: /builds/Azadeh-Afzar/Web-Development/Kianic-Jekyll-Theme/_config.yml
Configuration file: /builds/Azadeh-Afzar/Web-Development/Kianic-Jekyll-Theme/_config.yml
Katex Configuration: Found KaTeX js at: /usr/local/rvm/gems/ruby-2.6.3/gems/jekyll-katex-0.4.3/lib/assets/js/katex.min.js
Source: /builds/Azadeh-Afzar/Web-Development/Kianic-Jekyll-Theme
Destination: development
Incremental build: disabled. Enable with --incremental
Generating...
Jekyll Feed: Generating feed for posts
done in 5.36 seconds.
Auto-regeneration: disabled. Use --watch to enable.
can you look at this? i'm really confused and used many ways to solve it but still failed.
thank you
According to this blog post kramdown can easily support Katex without this plugin. See the section "Method 2".
Also see this post: https://gendignoux.com/blog/2020/05/23/katex.html
Probably I'm simply too dumb to follow your guide. These are the steps that I did so far:
_config.yml
. This is what I have now:
plugins:
- jekyll-feed
- jekyll-katex
group :jekyll_plugins do
gem "jekyll-feed", "~> 0.6"
gem 'jekyll-katex', "~> 0.2"
end
bundle install
bundle exec jekyll serve
and had a long error output:
bundler: failed to load command: jekyll (/usr/local/bin/jekyll)
Bundler::GemRequireError: There was an error while trying to load the gem 'jekyll-katex'.
Gem Load Error is: undefined method `[]' for nil:NilClass
Backtrace for gem load error is:
/var/lib/gems/2.5.0/gems/jekyll-katex-0.2.0/lib/jekyll-katex/configuration.rb:22:in `js_path'
/var/lib/gems/2.5.0/gems/jekyll-katex-0.2.0/lib/jekyll/tags/katex.rb:14:in `<class:Katex>'
/var/lib/gems/2.5.0/gems/jekyll-katex-0.2.0/lib/jekyll/tags/katex.rb:12:in `<module:Tags>'
/var/lib/gems/2.5.0/gems/jekyll-katex-0.2.0/lib/jekyll/tags/katex.rb:7:in `<module:Jekyll>'
/var/lib/gems/2.5.0/gems/jekyll-katex-0.2.0/lib/jekyll/tags/katex.rb:6:in `<top (required)>'
/var/lib/gems/2.5.0/gems/jekyll-katex-0.2.0/lib/jekyll-katex.rb:7:in `require'
/var/lib/gems/2.5.0/gems/jekyll-katex-0.2.0/lib/jekyll-katex.rb:7:in `<top (required)>'
/usr/local/lib/site_ruby/2.5.0/bundler/runtime.rb:81:in `require'
/usr/local/lib/site_ruby/2.5.0/bundler/runtime.rb:81:in `block (2 levels) in require'
/usr/local/lib/site_ruby/2.5.0/bundler/runtime.rb:76:in `each'
/usr/local/lib/site_ruby/2.5.0/bundler/runtime.rb:76:in `block in require'
/usr/local/lib/site_ruby/2.5.0/bundler/runtime.rb:65:in `each'
/usr/local/lib/site_ruby/2.5.0/bundler/runtime.rb:65:in `require'
/usr/local/lib/site_ruby/2.5.0/bundler.rb:114:in `require'
/var/lib/gems/2.5.0/gems/jekyll-3.8.3/lib/jekyll/plugin_manager.rb:51:in `require_from_bundler'
/var/lib/gems/2.5.0/gems/jekyll-3.8.3/exe/jekyll:11:in `<top (required)>'
/usr/local/bin/jekyll:23:in `load'
/usr/local/bin/jekyll:23:in `<top (required)>'
/usr/local/lib/site_ruby/2.5.0/bundler/cli/exec.rb:74:in `load'
/usr/local/lib/site_ruby/2.5.0/bundler/cli/exec.rb:74:in `kernel_load'
/usr/local/lib/site_ruby/2.5.0/bundler/cli/exec.rb:28:in `run'
/usr/local/lib/site_ruby/2.5.0/bundler/cli.rb:424:in `exec'
/usr/local/lib/site_ruby/2.5.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/local/lib/site_ruby/2.5.0/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/usr/local/lib/site_ruby/2.5.0/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
/usr/local/lib/site_ruby/2.5.0/bundler/cli.rb:27:in `dispatch'
/usr/local/lib/site_ruby/2.5.0/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
/usr/local/lib/site_ruby/2.5.0/bundler/cli.rb:18:in `start'
/usr/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/exe/bundle:30:in `block in <top (required)>'
/usr/local/lib/site_ruby/2.5.0/bundler/friendly_errors.rb:124:in `with_friendly_errors'
/usr/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/exe/bundle:22:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
Bundler Error Backtrace:
/usr/local/lib/site_ruby/2.5.0/bundler/runtime.rb:84:in `rescue in block (2 levels) in require'
/usr/local/lib/site_ruby/2.5.0/bundler/runtime.rb:80:in `block (2 levels) in require'
/usr/local/lib/site_ruby/2.5.0/bundler/runtime.rb:76:in `each'
/usr/local/lib/site_ruby/2.5.0/bundler/runtime.rb:76:in `block in require'
/usr/local/lib/site_ruby/2.5.0/bundler/runtime.rb:65:in `each'
/usr/local/lib/site_ruby/2.5.0/bundler/runtime.rb:65:in `require'
/usr/local/lib/site_ruby/2.5.0/bundler.rb:114:in `require'
/var/lib/gems/2.5.0/gems/jekyll-3.8.3/lib/jekyll/plugin_manager.rb:51:in `require_from_bundler'
/var/lib/gems/2.5.0/gems/jekyll-3.8.3/exe/jekyll:11:in `<top (required)>'
/usr/local/bin/jekyll:23:in `load'
/usr/local/bin/jekyll:23:in `<top (required)>'
Dependency Error: Yikes! It looks like you don't have jekyll-katex or one of its dependencies installed. In order to use Jekyll as currently configured, you'll need to install this gem. The full error message from Ruby is: 'cannot load such file -- jekyll-katex' If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/!
jekyll 3.8.3 | Error: jekyll-katex
Any help is appreciated.
I am creating a basic Jekyll blog. It works flawlessly on local, however on pushing to gh-pages I get the error in the title. Does gh-pages not support this?
Hi, thanks for this package! There's a new KaTeX release. Would be great if this package used that.
I believe this bug was first reported in issue #3, fixed by PR #4 and recently reintroduced again by PR #15.
I do not specify any katex configuration options in my _config.yml
file, so jekyll-katex/configuration.rb
will set JEKYLL_CONFIG
to {}
. But then it tries to do a double indexing:
JEKYLL_CONFIG['rendering_options']['throw_error']
The first indexing operation will return nil
, so the second indexing operation will throw the following error:
vendor/bundle/ruby/2.5.0/gems/jekyll-katex-0.3.1/lib/jekyll-katex/configuration.rb:34:in `global_rendering_options': undefined method `[]' for nil:NilClass (NoMethodError)
Maybe that code could be expressed more robustly by Ruby's Hash#merge operation? I might try and create a PR for this later.
When I have code block (rendered by rouge) in my post.md e.g.
```bash
echo $ENV_VAR
````
and I want to render LaTeX as well using $$
tags in markdown and katexmm
in layout:
{% katexmm %}
{{ content }}
{% endkatexmm %}
I end up with KaTeX exception Liquid Exception: ParseError: KaTeX parse error: Expected 'EOF', got … in /_layouts/post.html
. MathJax simply ignores unmatched $
so it wasn't a problem before migration. Additionally, since rouge runs somewhere between putting templates together and running KaTeX, so neither escaping $
manually in all .md files, nor writing a custom filter that prepends all $
with \
help. This error happens on $ pairing, so throw_error: false
cannot fix it.
It would be helpful to be able to ignore $
at least in certain contexts, like e.g. code
tag.
Hi,
Thank you for this Jekyll plugin. It works really well so far. However, I tried adding macros to the configuration, like so:
katex:
rendering_options:
macros:
- "\\Nat": "\\mathbb{N}"
I tried several variations with quotes and backslashes, but none of them works. Is it supported?
See #6 .
There is potential for a JS engine to not be found, giving a user a cryptic error.
Thank you for sharing with this plugin, but as I deployed this site to Github, it told me Liquid syntax error: Unknown tag 'katex
. I have checked this issue and found out that the official whitelist excludes the third-party plugins for the sake of safety, just like jekyll-katex
.
There is a workaround to deal with this problem is that change the name of the repo to others except for <username>.github.io
, accordingly changing the site from User organization mode to project mode. However, I want to make Github build this code for me, and save the permalink <username>.github.io
instead of <username>.github.io/<repo-name>
.
In summary, I wonder if there is any way I can use your plugins as well as stay in User/Organization mode?
Originally motivated by user report #7 .
It was unclear what version was required to use the katexmm
tag. Some longer term solutions may include release notes.
Hey there,
I'm trying to use this plugin to integrate katex in my personal page.
The {$ katexmm $}
looked quite appealing such that I can write latex-style math-mode triggers in markdown files.
However, bundle exec jekyll serve
yields
Liquid Exception: Liquid syntax error (line 8): Unknown tag 'katexmm' in /_layouts/post.html
as soon as I put {% katexmm %}
... {$ endkatexmm $}
into some html file.
The other {% katex display %}
and {% katex %}
environments work perfectly fine.
Context: I added the jekyll-katex plugin via Gemfile and bundle install
. I included the katex css in the headers.
Did I miss anything?
Following issue #16 there should be clearer documentation oh which one of KaTeX's config options are supported or not supported.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.