Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mathjax and backticks #4

Closed
dmenne opened this issue Jul 12, 2016 · 13 comments
Closed

Mathjax and backticks #4

dmenne opened this issue Jul 12, 2016 · 13 comments
Labels

Comments

@dmenne
Copy link

dmenne commented Jul 12, 2016

This was reported before in getgrav/grav#929, but proved to be an issue only when mathjax plugin is activated.

Grav 1.1.0 rc3, Plugin Mathjax 1.40

Sample code, simplified from Rcmd (R + knitr) comes in separate zip file because is shows problems with code blocks.
There seems to be a problem when there are 2 code blocks. Grav generates the following wrong output (if we accept that Catalina should be Catilina):

Wrong output produces be grav

MarkdownPad and knitr produce correct output:

Correct output produced by Markdownpad

Looks like some greedy regexps involved trying to catch the last backticks.....

item.zip

Gruß von TÜ nach TÜ

@Sommerregen
Copy link
Owner

Hi @dmenne ,

you are right the regexp is to greedy and as I can see this plugin only works with Grav v0.1.0- for now. I need to rewrite this plugin a bit using Grav features, which got recently added to core. Will see what I can; I have to prioritize some things. Do you need the fix of this plugin immediately or can I think about in the next week?

@dmenne
Copy link
Author

dmenne commented Jul 13, 2016

No hurry. The people who read this

http://menne-biomed.de/blog/multiple-indexes-stan

can read latex.

@dmenne
Copy link
Author

dmenne commented Aug 4, 2016

Any chance?

@Sommerregen
Copy link
Owner

Yes. I've come up something with this. But time is limited. You must wait for it a little longer. Sorry.

@Sommerregen
Copy link
Owner

Hi @dmenne ,

I just updated a pre-release version in the develop branch. In order to use and install this plugin you now need Grav v1.1.0+. Switch to the the testing release and install Mathjax v1.5.0-beta.1.

If you experience any further bugs, please add a comment to this thread.

Best,
Sommerregen

@dmenne
Copy link
Author

dmenne commented Aug 5, 2016

Looks great! Thanks for your work
mathjax

Greatings from another Neckarschachtel

@dmenne dmenne closed this as completed Aug 5, 2016
@dmenne
Copy link
Author

dmenne commented Aug 5, 2016

Sorry to reopen this. On my local server, everything was perfect. On my remote server, with same IIS configuration, same php 7.0, on activating mathjax I get an error on all pages (not only those with mathjax)

a

and the following in the log:
grav.txt

@dmenne dmenne reopened this Aug 5, 2016
@dmenne
Copy link
Author

dmenne commented Aug 6, 2016

I believe you forgot to test the case when there is no formula on a page. Checking for hashes corrects that; line 222, classes/mathjax.php

    public function normalize($content, $type = 'html')
    {
        if (is_null($this->hashes))  return $content; // Added DM
        $hashes = array_keys($this->hashes);
        $text = array_column(array_values($this->hashes), $type);

@Sommerregen
Copy link
Owner

@dmenne You are totally right! I haven' tested this case. However initializinghashes in the correct way Mathjax.php, L40 via

protected $hashes = [];

should solve that problem, too. You can test it and report back. I'll work on the code and improve it a bit more.

@dmenne
Copy link
Author

dmenne commented Aug 6, 2016

Works.

@Sommerregen
Copy link
Owner

@dmenne FYI I made a new release and some further small changes in the develop branch (the latter can be downloaded only via GitHub). Please read the changelog before updating. There is one breaking change. Don't know if it touches you.

@dmenne
Copy link
Author

dmenne commented Aug 6, 2016

Not tested thoroughly, but looks ok.

http://menne-biomed.de/blog/multiple-indexes-stan

@Sommerregen
Copy link
Owner

@dmenne Ok, thanks! Released stable version MathJax v1.5.0 today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants