ENH: Add option to disable MathJax (#19824).
State: closed

This prevents MathJax from processing table contents:

<img width="599" alt="screen shot 2018-02-24 at 7 36 50 am" src="https://user-images.githubusercontent.com/1804856/36632244-0c07bdac-1939-11e8-85eb-0c22d42991d1.png">

I'm hoping for a code review, to find out if this might be accepted. If so, I'll add the tests/docs.

- [x] closes #19824
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

Labels:
name: Enhancement
name: Visualization
description: plotting

Comments:
@davidchall : Thanks for the PR!  For future reference, you should probably wait for us to weigh in on your filed issue before opening a PR.  That's where we would "accept" the idea or not.

Once it's at the PR stage, we will not accept the changes until you add the documentation and tests.
@gfyoung I apologize, and will keep the discussion over on the issue. 
> I apologize, and will keep the discussion over on the issue.

No worries!  You're new to the process, so I wouldn't have expected you to be familiar with that.
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/19856?src=pr&el=h1) Report
> :exclamation: No coverage uploaded for pull request base (`master@d44a6ec`). [Click here to learn what that means](https://docs.codecov.io/docs/error-reference#section-missing-base-commit).
> The diff coverage is `91.66%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/19856/graphs/tree.svg?token=eZ4WkYLtcO&src=pr&height=150&width=650)](https://codecov.io/gh/pandas-dev/pandas/pull/19856?src=pr&el=tree)

```diff
@@            Coverage Diff            @@
##             master   #19856   +/-   ##
=========================================
  Coverage          ?   91.66%           
=========================================
  Files             ?      150           
  Lines             ?    49039           
  Branches          ?        0           
=========================================
  Hits              ?    44951           
  Misses            ?     4088           
  Partials          ?        0
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.04% <91.66%> (?)` | |
| #single | `41.82% <16.66%> (?)` | |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/19856?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/formats/format.py](https://codecov.io/gh/pandas-dev/pandas/pull/19856/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvZm9ybWF0LnB5) | `96.26% <100%> (ø)` | |
| [pandas/core/config\_init.py](https://codecov.io/gh/pandas-dev/pandas/pull/19856/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29uZmlnX2luaXQucHk=) | `100% <100%> (ø)` | |
| [pandas/io/formats/style.py](https://codecov.io/gh/pandas-dev/pandas/pull/19856/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvc3R5bGUucHk=) | `96.03% <85.71%> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/19856?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/19856?src=pr&el=footer). Last update [d44a6ec...42224c9](https://codecov.io/gh/pandas-dev/pandas/pull/19856?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

looks much nicer to me.
@jreback @TomAugspurger 

`Series` doesn't actually have a `_repr_html_` method right now. Now that I've explored the code a bit more, I think I agree with @jreback that this new logic should instead go in `HTMLFormatter`. If `Series` were given a `_repr_html_` method then it would probably use `HTMLFormatter`, so would automatically get this new logic.

However, I have noticed that `Styler._repr_html_()` uses a completely separate set of logic from `DataFrame._repr_html_()`. This means that the new `display.html.use_mathjax` option is not respected when using `df.style`. There it seems that the `class="tex2jax_ignore"` would need to be injected into the `table_attributes` variable. Any thoughts on this?
@jreback @TomAugspurger I think I resolved the remaining problems. Please let me know if you are happy to merge, and I can rebase and squash the commits.
This all looks good. I'm +1 if others are +1 on the option affecting `Styler` as well.
thanks @davidchall very nice!