Add basic math editing features #2038

Merged
merged 2 commits into from Feb 25, 2014

Projects

None yet

7 participants

Contributor
rgaiacs commented Feb 19, 2014

This solve bug 945228.

Note: This is based on @fred-wang's Javascript (La)TeX to MathML parser that has a Firefox Add-ons that have been revised already.

This add a plugin for CKEditor that add basic math editing features based on (La)TeX input.

You can test it here using kuma's version of CKEditor and here using CKEditor4.

There are at least two "minor bugs" that are related with kuma's version of CKEditor. You can find more information about it here and here.

Raniere Silva Add CKEditor-TeXZilla plugin
Link to CKEditor-TeXZilla: https://github.com/r-gaia-cs/CKEditor-TeXZilla

For this commit it was used c4e484c7f9fd71f5f313892a3da2919ee2b14722
4984e66
Owner

Thanks for the pull request! @darkwing and/or @openjck should check this out. And maybe @elchi3 since he has a working kuma box and has done some of the MathML editing on MDN.

Member

This is good from a code perspective but since @elchi3 is a world renowned MathML expert, I'd like him to see if this is useful.

Contributor
icaaq commented Feb 19, 2014

texzilla.js has some warnings (52) if I run it thru http://www.jshint.com/

Member

Unfortunately every CKEditor plugin will. One lesson I've learned is that you never modify the original code of an external library or plugin, so as long as it works and there are no security issues, I think we're fine.

Contributor
icaaq commented Feb 19, 2014

missing semicolon could at least be fixed imho :)

Contributor
openjck commented Feb 20, 2014

One lesson I've learned is that you never modify the original code of an external library or plugin

It looks like Raniere wrote the plugin himself. (Go Raniere!)

I agree it would be nice to pass JSHint. It can be opinionated at times (though not as much as JSLint) but there are usually good reasons for it. Writing JS without J*Lint always feels like walking through a minefield to me. But we might have to agree to disagree on that. 😄

Contributor

Just my two cents on this: the core of the TeX-to-MathML parser is generated from Jison (http://zaach.github.io/jison/docs/). While it is certainly possible to fix the JSLint errors for parts that have been written by hand, I don't think it would be a good idea to try to fix the one generated by Jison (we'll have to do that each time we update the grammar). However, @r-gaia-cs could probably try to fix as many errors as possible...

Contributor
rgaiacs commented Feb 20, 2014

Thanks all for the comments.

@openjck I will run JSLint and fix as many errors as possible.

Contributor
Elchi3 commented Feb 20, 2014

I just tested this on my box and it works great. I used some examples from MathJax (http://www.mathjax.org/demos/tex-samples/). The TeX source is stored in the element, so that you can edit the TeX again, once the MathML got generated; very cool! In a spot check, I haven't seen any (JS) errors, so I would say r+ on the functionality.

Some layout ideas (optional, not needed per se):

  • Above the box it could say: "Please insert your (LaTex) code:" and then below the box: "(Clicking outside of the textarea updates the preview)".
  • Maybe the two checkboxes could have a "Options:" caption above and they could be next to each other as there is some room on the right.

Thanks all, happy to see MDN becoming a mathematician and scientists friendly platform!

Owner

@r-gaia-cs, great work! do you prefer bugzilla bugs or GitHub issues?
@Elchi3, can you file new bugs or GitHub issues for those follow-ups?

Contributor

I guess we can use GitHub issues for CKEditor-TeXZilla (I already reported some bugs):
https://github.com/r-gaia-cs/CKEditor-TeXZilla/issues?state=open

Contributor
rgaiacs commented Feb 20, 2014

@groovecoder Since the plugin can be reused on others CKEditors instances I prefer GitHub issues.

Owner

@Elchi3 - are you good to merge this as-is and to file follow-up issues at https://github.com/r-gaia-cs/CKEditor-TeXZilla/issues?state=open ? I'd like to merge before this bit-rots.

Contributor
rgaiacs commented Feb 24, 2014

@groovecoder, @Elchi3 I have plans to update this PR in a few hours.

Contributor
rgaiacs commented Feb 25, 2014

I update this PR with the last @fred-wang last changes in TeXZilla and others.

Owner

@Elchi3 - can you check this out again now with these updates?

Contributor
Elchi3 commented Feb 25, 2014

r+

@groovecoder groovecoder merged commit f3a5fd8 into mozilla:master Feb 25, 2014

1 check passed

default Jenkins build 'mdn-github' #2446 has succeeded
Details
@rgaiacs rgaiacs deleted the rgaiacs:TeXZilla branch Mar 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment