Code Monkey home page Code Monkey logo

jekyll-katex's People

Contributors

ashmaroli avatar dependabot[bot] avatar dthul avatar hrjakobsen avatar linjer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

jekyll-katex's Issues

Line breaker not support

KaTeX support line breakers \ and \newline.
But with jekyll-katex, \ rise a error, and \newline is not work too.

Testing

Everything is currently manually tested only, however, there's an obvious need to have formal unit and integration tests.

Katexmm display mode does not work

I followed the instructions in the README

  1. Gemfile looks like this
group :jekyll_plugins do
  gem "github-pages"
  gem "jekyll-feed", "~> 0.6"
  gem "jekyll-katex", "~> 1.0.0"
end
  1. I ran bundle install
Using github-pages 200
Using jekyll-katex 1.0.0 (was 0.1.2)
  1. I added the CSS file in my header.

  2. Added {% katexmm %} {{content}} {% endkatexmm %} in my default.html.

  3. Inline mode $ with renders great, but display mode with $$ gives me blank.

Any idea what may be up?

Extremely slow build speed.

As much as I'd like to use this plugin, as it performs much better than Mathjax, it's unbearably slow. What used to take 4-7 seconds to generate the feed for posts is now taking 40+ seconds:

image

There can't be > in katexmm

There's one line in my blog:

$a > b$

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.

SyntaxError on load

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?

Inline matrix display

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?

Found a Liquid block containing the excerpt separator "\n\n"

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.

Does not correctly render after being uploaded

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.

image

Liquid syntax error: Unknown tag 'katex'

I have followed your instructions:

  1. Add the plugin to _config.yml, e.g.:
    plugins:
      - jekyll-katex
  2. Add jekyll-katex to your Gemfile plugin block:
    group :jekyll_plugins do
      gem 'jekyll-katex'
    end
  3. Add KaTeX CSS and Fonts. Put the following in my page headers:
    <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!

Incorrect path output for KaTeX js

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

Javascript engine missing!

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

Error loading plugin when katex configuration options are not specified in _config.yml

Probably I'm simply too dumb to follow your guide. These are the steps that I did so far:

  1. Added the plugin in my _config.yml. This is what I have now:
    plugins:
      - jekyll-feed
      - jekyll-katex
    
  2. Added the plugin in my Gemfile plugin block. This is what I have:
    group :jekyll_plugins do
      gem "jekyll-feed", "~> 0.6"
      gem 'jekyll-katex', "~> 0.2"
    end
    
  3. I run bundle install
  4. I run 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)>'
    
    Note that if I didn't step 2, then the error is the same. If instead I didn't step 3, then the error is:
    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.

Update to KaTeX 0.9.0?

Hi, thanks for this package! There's a new KaTeX release. Would be great if this package used that.

Bug in configuration

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.

Issue when $ appears in code block

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.

Macro options?

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?

How to use this plugin and deploy the site to Github in User / Organization mode

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?

Problems with katexmm

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.