Coder Social home page Coder Social logo

Comments (5)

msakuta avatar msakuta commented on August 29, 2024 1

Yes, adding protected to the return value of syntax_plugin_markdowku_ulists's getAllowedTypes method like below also fixed the problem.

    function getAllowedTypes() {
        return array('formatting', 'substition', 'paragraphs', 'baseonly', 'container', 'protected');
    }

I also checked the source of standard DokuWiki syntax for unordered lists. Like you said, the standard syntax accepts protected, although I have no idea what #XXX new means in the source comment.

dokuwiki/inc/parser/parser.php (462):

class Doku_Parser_Mode_listblock extends Doku_Parser_Mode {

    function Doku_Parser_Mode_listblock() {
        global $PARSER_MODES;

        $this->allowedModes = array_merge (
                $PARSER_MODES['formatting'],
                $PARSER_MODES['substition'],
                $PARSER_MODES['disabled'],
                $PARSER_MODES['protected'] #XXX new
            );

    //    $this->allowedModes[] = 'footnote';
    }

I'm still not sure which plugin should be fixed. I agree that MathJax markup should not include any other DokuWiki syntax, but it's determined solely by MathJax plugin's getAllowedTypes (which returns empty array, derived from DokuWiki_Syntax_Plugin class), not by the return value of getType. getType affects only the other syntaxes which may contain a MathJax markup. I mean, it feels more like a formatting syntax from other plugins' perspective.

That said, I'm inclined to fixing markdowku side, because it's at least not consistent with standard syntax.

from dokuwiki-plugin-mathjax.

liffiton avatar liffiton commented on August 29, 2024

I'm afraid I'm not familiar enough with the dokuwiki internals either, and I'm not sure what's going on there. Your understanding matches mine, but clearly we're missing something. You could try to change the return value of getType in the mathjax plugin from protected to disabled, and let me know if that helps. Unfortunately, I don't see any other issue given my limited understanding of dokuwiki's parsing.

from dokuwiki-plugin-mathjax.

msakuta avatar msakuta commented on August 29, 2024

Same happened for me. In my case, changing return value of getType to 'formatting' magically solved the issue (changing to disabled didn't help).

First, this problem happens only if I use two or more underscores in math in a bulleted line. I guess this problem is caused by both italic style (surrounded by underscores) and unordered list (lines starting with a *).

For example, * $x_0$ is okay, but * $x_0, y_0$ has the problem.

Another speculation of mine is that the meaning of getType's return value is that, in which types of parser modes this plugin should be accepted, rather than which types of modes this plugin wants to accept.

So, this is probably what's happening:

  1. First, markdowku's ulists syntax plugin finds a line of text beginning with an asterisk *.
  2. ulists enters the mode plugin_markdowku_ulists which do not accept protected modes. (see /plugins/markdowku/syntax/ulists.php)
  3. Since syntax_plugin_mathjax_protecttex.getType() returns protected, MathJax protection is not invoked.
  4. markdowku's italicunderline syntax is invoked, which destroys the LaTex markups.

The return value of getSort doesn't matter because unordered list container (between * and \n) is larger than the math, so the unordered list is always processed first.
The problem is that markdowku overrides both underscores and unordered lists, which makes the situation complicated and hard to debug.

Considering the true purpose, I think syntax_plugin_mathjax_protecttex.getType() should return formatting, but I'm not sure if it has any negative side-effects. I love both plugins (I use lots of maths in my DokuWiki), so I wish this issue to have been fixed.

from dokuwiki-plugin-mathjax.

Grahack avatar Grahack commented on August 29, 2024

The formatting trick did it for me too. Thanks.
I leave this issue open until the code is updated and/or the trick tripled checked.
Cheers.

from dokuwiki-plugin-mathjax.

liffiton avatar liffiton commented on August 29, 2024

Thanks for digging into this and figuring it out. From the syntax plugin documentation and its base code, it looks to me like getType() should return the parser mode that the plugin is. And of the types available, protected seems the most appropriate for this plugin. Isn't the proper fix then for markdowku's ulists module to add protected to its list of allowed types?

Protected blocks (like <file>) can be placed in list items in plain Dokuwiki syntax, anyway, so I don't see a problem with allowing the protected type in ulists. If I understand correctly, markdowku doesn't allow for <file> blocks, etc. to be placed in unordered lists -- while Dokuwiki itself does -- which would also seem to be an issue.

I see no negative side-effects of your fix myself, but I want to find the most appropriate fix for this. I think that fix is to add 'protected' to the allowed types in markdowku's ulists. Does that sound right to you? If so, we can report it to markdowku's author.

from dokuwiki-plugin-mathjax.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.