Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 30 Jun 2022
- Updated MathJax version to 3.2.2

## 22 Nov 2019
- Updated MathJax version to 3.0.0

## 30 Mar 2014
- Updated MathJax version to 2.3.0

Expand Down
37 changes: 16 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# MathJax-Rails

We are living in an age where displaying math on web pages will never be hard - thanks to the great work of [MathJax](https://github.com/mathjax/MathJax).
We are living in an age where displaying math on web pages will never be hard - thanks to the great work of [MathJax](https://github.com/mathjax/MathJax).

To quote the description from it's official website,

> [MathJax](https://github.com/mathjax/MathJax) is an open source JavaScript display engine for mathematics that works in all modern browsers.
>
>
> No more setup for readers. No more browser plugins. No more font installations… It just works.

## Why bother with another gem?
Expand Down Expand Up @@ -33,14 +33,14 @@ To see the actual version, check the constant Mathjax::Rails::MATHJAXVERSION.
add this line to your Gemfile:

gem 'mathjax-rails'

then:

$ bundle install

## The other gem

The new gem is more recently maintained.Thank you Manu S Ajith.
The new gem is more recently maintained.Thank you Manu S Ajith.

[![Gem Version](https://badge.fury.io/rb/mathjax-rails.png)](http://badge.fury.io/rb/mathjax-rails)
# MathjaxRails
Expand Down Expand Up @@ -74,7 +74,7 @@ add the script tag inside app/views/layouts/application.html.erb:

``` rhtml
<%= mathjax_tag %>
```
```

and you're done!

Expand All @@ -84,28 +84,23 @@ To try it, write a simple formula, for example:

## Configuration

By default, the `TeX-AMS_HTML-full.js` is loaded as the configuration file.

If you do not want any configuration file to be loaded:
By default, the `tex-chtml-full.js` component is loaded.

``` rhtml
<%= mathjax_tag :config=>false %>
```
If you want to load another configuration file, say `Accessible-full.js`:
If you want to load another component file, say `tex-svg-full.js`:

``` rhtml
<%= mathjax_tag :config=>'Accessible-full.js' %>
<%= mathjax_tag :component => 'tex-svg-full.js' %>
```
Additional configuration can be added directly before mathjax_tag, for example:

``` rhtml
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [ ['$','$'] ],
processEscapes: true
}
});
<script>
MathJax = {
tex: {
inlineMath: [ ['$','$'] ],
processEscapes: true
}
};
</script>
<%= mathjax_tag %>
```
Expand All @@ -124,7 +119,7 @@ If you have a fast CDN service at hand, you don't need this gem.

Putting your MathJax at CDN is probably the best choice.

By `dmarczal`,
By `dmarczal`,

To work in rails 3.1 on production environment wih ngnix I just comment the follow line in production.rb

Expand Down
5 changes: 4 additions & 1 deletion lib/mathjax/rails/controllers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ def giveOutStaticFile
ext = ''
ext = ".#{params[:format]}" if params[:format]
filename = params[:uri]+ext
filepath = "../../../../vendor/#{Mathjax::Rails::DIRNAME}/#{filename}"
filepath = "../../../../vendor/#{Mathjax::Rails::DIRNAME}/es5/#{filename}"

extname = File.extname(filename)[1..-1]
mime_type = Mime::Type.lookup_by_extension(extname)
Expand All @@ -17,4 +17,7 @@ def giveOutStaticFile
render :status => 404
end
end

def verify_authenticity_token
end
end
5 changes: 2 additions & 3 deletions lib/mathjax/rails/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ module Mathjax
module Rails
module ViewHelpers
def mathjax_tag(opt={})
opt[:config] ||= 'TeX-AMS_HTML-full.js'
opt[:config] = nil if opt[:config] == false
"<script src=\"#{mathjax_path(:uri=>'MathJax.js', config: opt[:config])}\" type=\"text/javascript\"></script>".html_safe
opt[:component] ||= 'tex-chtml-full.js'
"<script src=\"#{mathjax_path(:uri => opt[:component])}\" type=\"text/javascript\"></script>".html_safe
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/mathjax/rails/version.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Mathjax
module Rails
VERSION = '2.6.1'
MATHJAXVERSION = '2.6.1'
VERSION = '3.2.2'
MATHJAXVERSION = '3.2.2'
DIRNAME = 'mathjax'
end
end
1 change: 0 additions & 1 deletion mathjax-rails.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ Gem::Specification.new do |s|
s.executables = `git ls-files`.split("\n").select{|f| f =~ /^bin/}
s.require_path = 'lib'
s.license = 'MIT'

end
2 changes: 2 additions & 0 deletions vendor/mathjax/.github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github: [numfocus]
custom: ['https://numfocus.org/donate-to-mathjax']
54 changes: 54 additions & 0 deletions vendor/mathjax/.github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Replace the text below with the details of the issue you are facing.
DO NOT simply erase the form and type a free-form response.**
-----

### Issue Summary

A summary of the issue and the browser/OS environment in which it occurs. If
suitable, include the steps required to reproduce the bug.

### Steps to Reproduce:

1. This is the first step
2. This is the second step
3. Further steps, etc.

Any other information you want to share that is relevant to the issue
being reported. Especially, why do you consider this to be a bug? What
do you expect to happen instead?

### Technical details:

* MathJax Version: 3.2
* Client OS: (e.g., Mac OS X 10.8.4)
* Browser: (e.g., Chrome 29.0.1547.57)

I am using the following MathJax configuration:

``` js
MathJax = {
...
};
```

and loading MathJax via

``` html
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
```

### Supporting information:

* Please supply a link to a (live) minimal example page, when possible.
* If your issue is with the display of the mathematics produced by MathJax, include a screen snapshot that illustrates the problem, when possible.
* Check your browser console window for any error messages, and include them here.
* Include the MathJax configuration you are using, and the script tag that loads MathJax itself.
20 changes: 20 additions & 0 deletions vendor/mathjax/.github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
6 changes: 1 addition & 5 deletions vendor/mathjax/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
.DS_Store
docs/build/html-mathjax-site
config/local/*.js
!config/local/local.js
unpacked/config/local/*.js
!unpacked/config/local/local.js

7 changes: 0 additions & 7 deletions vendor/mathjax/.npmignore

This file was deleted.

9 changes: 4 additions & 5 deletions vendor/mathjax/.travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
dist: focal
language: node_js
node_js:
- '5'
- stable
sudo: false
script:
- npm install
- npm test
branches:
only:
- master
- /^\d+\.\d+/
- "/^\\d+\\.\\d+/"
deploy:
provider: npm
email: [email protected]
api_key:
secure: q7e4haV9hAHng28w6EBnOc6ptorxjxeATW6ZocYiPk68To3IUHMt615rzyotfA5TBCcPJyeUJiqNcuUXbh+r8HmER4bJsjaGMpETPSkdvzQ1bYg2EJEvT6V/xc+sRGoj5ri/F2uH99AYnF99IugjeWvjpp5F5z370fJIMiUmXX8=
secure: rdvJ27qbw4DZJl49NSf/ybkeHWNWnk2MajS8Y8bMKwI8RaDyEGcAm3frA+CfBw+YHWl71KRJlQHL69YgVwp1nMSzKrGOpwrbL3TMFrFMdBC6tJ30dX1HSvAg9eU5K12E5672MM8qkTwJdYXsvEcyYlzRR+sogR8jTWRl3APuAwY=
on:
tags: true
Loading