goessner / mdmath

LaTeX Math for Markdown inside of Visual Studio Code.
MIT License
748 stars 56 forks source link

Support doxygen-style math delimiters #121

Open bilderbuchi opened 2 years ago

bilderbuchi commented 2 years ago

Summary

The Readme tells us that mdmath uses "markdown-it-texmath's support of different formula delimiters". In the list of Mdmath: Delimiters configuration settings, doxygen is conspicuously absent although it's listed in markdown-it-texmath's Readme.

Using this markdown file

Dollars:

$$
  L[y] := y'' - V y = \rho(x).
$$

Brackets:

\[
  L[y] := y'' - V y = \rho(x).
\]

Doxygen:

\f[
  L[y] := y'' - V y = \rho(x).
\f]

I tested different settings for the Mdmath: Delimiters settings.

brackets works correctly. Interestingly I need a VS Code restart for the setting to become active.

Expected behavior

Using the doxygensetting, I expect the formula to be rendered.

Actual behavior

Unfortunately, using doxygen does not seem to do anything - the code remains raw and not rendered into a formula image (I suspect that the dollars variant keeps getting rendered because of base markdown extension support)

Environment

     Operating system: windows 10
       VSCode version: 1.64.2
Markdown+Math version: 2.7.4
bilderbuchi commented 2 years ago

@goessner is there anything I can do on my side (tweak settings in a file or so) to enable doxygen math delimiters in mdmath, Stefan?

goessner commented 2 years ago

Yes ... please try to add doxygen delimiters to the delimiters array in

https://github.com/goessner/markdown-it-texmath

I will come back to markdown-it-texmath and mdmath in two weeks at the earliest.

thanks

bilderbuchi commented 2 years ago

Thank you! I tried to poke around and do something like this already, but unfortunately I could not locate the files related to the VS Code extension on my disk. (I'm not a web/JS person, so that will also not help) Doxygen delimiters are already present, though, as far as I can tell: https://github.com/goessner/markdown-it-texmath/blob/b08ddd342f26ddcdc3afa2218f1b55410f44029b/texmath.js#L215-L234

The point I tried to make in the issue description is that support seems to be there in markdown-it-texmath, but it does not work in mdmath.

goessner commented 2 years ago

Ahh ... I see. In fact I need to update mdmath to current markdown-it-texmath version. This will take same time beside other actions.

What you can try to do is replace in your folder

/Users/<name>/.vscode/extensions/mdmath/node-modules/markdown-it-texmath

the texmath.js file or the complete folder. If it works, it is fine, if not, you are lost and have to wait for my next update.

Alternatively you can copy the doxygen stuff into your texmath.js file.

bilderbuchi commented 2 years ago

Aahh, I was looking in APPDATA... Yes, replacement of the folder seems to have worked! I get preview of equations now.

Curiously, it seems empty lines are neecessary before starting an equation block (for it to be rendered correctly), which I'm not sure is expected for markdown, but I guess that's a markdown-it-texmath limitation?

Also, the \f{environment}{ Doxygen formula syntax does not work, but I think getting to that is probably more effort. I'll use manual enviroments \begin{eqnarray}/end{eqnarray} inside the block as a workaround.