Support » Plugins » Plugin Request: MathML converter

  • I am wondering if anyone has implimented a MathML markup plugin for WP. There is a php class converting ascii formulas to mathml, which is what I’m interested in. I am not competent enough in php to impliment a plug in for it… any clues would be appreciated.

Viewing 8 replies - 1 through 8 (of 8 total)
  • This doesn’t seem too difficult to implement as a filter.
    How would you want to mark the MathML in your content area? Something like:
    blah blah blah [mathml]sqrt(5*30)[/mathml] blah blah blah
    Is there a stardard in WP for this sort of thing?

    Ok, after much late-night turmoil fighting with regular expressions and doctype declarations, I have completed a plugin that will do ascii conversions to MathML using the library linked to above.
    Adding MathML to any page requires some crazy changes to your basic doctype declaration, and the server must report your page as XML. The end result is that when you add new posts, your page must be XML legal. If it isn’t, your page will not render at all. WordPress is pretty good about conforming to XHTML, so as long as you haven’t done anything really crazy, this shouldn’t be an issue.
    I have packaged it up and posted it at my site. You can download it there:

    That is way swank. Thank you. It installed no problems. For a time I have been using Jacques Distler’s Itex2MML plugin for Movable Type. So by necessity my content was xhtml 1.1 compliant and had the proper doc-types.
    I highly suggest a MathML plug-in like this one or a Itex2MML derivative (Itex is a LaTex derivative) to become a standard plug-in for WP.
    Again, thank you for your trouble ringmaster.

    Hey mang,
    I was trying to edit the ‘mathml.php’ file to include a filter…
    add_filter('comment_text', 'to_mathml', 9);
    I get the [mathml]…[/mathml] to translate, but it omits the tags. Do you know what I’m screwing up on here?
    Ultimately, I am trying to extend to the comments section.

    I hope to release very soon an itexToMML plugin for WordPress 1.2. There are some unresolved issues with crufty legacy code from b2. I don’t want to release my plugin before they are resolved.
    But rest assured that itexToMML is coming to WordPress real-soon-now.
    Jacques Distler

    How do you mean “omits the tags”?
    It’s possible that WordPress excludes the MathML markup when it processes the comment for display by default, because only certain HTML elements are allowed in comments, probably not those used in MathML. I am guessing that you would need to add the appropriate MathML tags to the $allowedtags array in wp-includes/kses.php.
    You might be able to define a new array (copy the old one and add MathML tags) in the mathml.php file and set the define (define('CUSTOM_TAGS', true);) to override those settings, but I haven’t tried it myself.

    It was the markup exclusions in the kses.php file. I added the math tags to the $allowedtags array and now the [mathml][/mathml] works properly in comments as well. Thanks mang.
    And Jacques, an itexToMML plugin would be awesome, as the binaries are already installed on my server.

    Even though the backslash bug in WordPress is still unfixed, I’m planning to release my itexToMML plugin to coincide with the release of WordPress 1.2.
    If you want an advance copy to play around with, send me an email, and I will tell you where you can download it.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Plugin Request: MathML converter’ is closed to new replies.