winterstein / Eclipse-Markdown-Editor-Plugin

Adds Markdown text editing support to Eclipse
Eclipse Public License 1.0
297 stars 73 forks source link

Mathjax support #34

Open ubuntuslave opened 10 years ago

ubuntuslave commented 10 years ago

It would be useful to support Mathjax rendering of LaTeX equations on the HTML Preview Window. For instance, the kind of Math syntax support that Mou can do.

For example, a workflow in the Editorial iPad app can do this:

<!DOCTYPE html>
<html>
<head><meta charset="utf-8"/>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    tex2jax: {
      inlineMath: [ ['$','$'], ["\\(","\\)"] ],
      displayMath: [ ['$$','$$'], ["\[","\]"] ]
    }
  });
</script>
<script type="text/javascript"
    src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
</head>

<body>
    Whatever text parsed from the md file comes here.
</body>

</html>

I hacked a little workflow called Share with Math. Hence, the basic code is like the above, so it will only require a minor alteration of the header file

I was looking at the source code (specifically, pagemodel/MarkdownPage.java ) and I see you use MarkdownJ, but I don't know if it can strip Math syntax, can it?

winterstein commented 10 years ago

Nice idea. Does MathJax render into html you can save and use?

MarkdownJ wouldn't hack it. We'd need to add a javascript text-to-html converter (probably using Java's javascript engine to use a javascript one).

NB: I'm unlikely to get round to this anytime soon. If you want to try -- let me know how you get on!