Closed jean-michel-gonet closed 6 years ago
Would it be possible for your plugin to handle math mode expressions without the dependency on the Mathjax plugin? That is, could I have this plugin's render()
function simply pass through the tex for all modes (which I think it really should be doing anyway):
$renderer->doc .= $data;
return true;
Then I imagine your plugin could locate, parse, and modify math mode expressions however it wanted whether the Mathjax plugin was installed or not. I'm just looking for the cleanest solution, but if there is some reason that would not work, that's fine. In that case, I just have a request and a question:
true
to indicate success for the latexport
mode?Thanks!
Thank you for your comments,
Sadly, I can't handle math mode expressions if they're directly injected in the $renderer->doc
property because I need to transform them before inserting as latex content:
\( ... \)
as inline delimiters to comply with LaTex\begin{equation} ... \end{equation}
as display delimiters to obtain numbered equations. \tag{...}
, because it interferes with numbering.Furthermore, I need to perform other, more radical, transformations with headings, images, tables, that involve a change in the precedence of the content. I wouldn't be able to manage it when syntax plugins write directly in the document's buffer.
On the second suggestion, latexport being able of handling math expressions without your syntax plugin; I've considered it at the beginning, but I don't see much value in it:
Those were my reasons to prefer the hassle of a dependency.
About the indentation and the returning value: of course, you're right. I've fixed that.
Okay, sounds good to me! I'll merge that, maybe tweak the render()
function a bit (like I said, I'm not sure why I'm not just always passing the tex through for other modes) and make an updated release. Thanks.
Oops, I didn't test this before merging, because it looked fine, but FYI the commit indented the if statements with non-breaking spaces (0xc2a0
), which really confused the PHP intepreter. :smile:
Thanks for your support. I guess unbreakable space is my fault. I just swapped to a new editor, and I'm not familiar with it.
Why?
This makes Mathjax a beautiful plugin to use together with mine.
Modification
I've added a specific call that occurs only in mode
latexport
, and placed it besides other similar calls.Check it in action
Use the following links: