platers / obsidian-linter

An Obsidian plugin that formats and styles your notes with a focus on configurability and extensibility.
https://platers.github.io/obsidian-linter/
MIT License
1.24k stars 82 forks source link

FR: mathjax linter #1174

Open conneroisu opened 1 month ago

conneroisu commented 1 month ago

Is Your Feature Request Related to a Problem? Please Describe.

A clear and concise description of what the problem is. Ex. I'm always frustrated when my mathjax get's messy in my notes.

Describe the Solution You'd Like

A clear and concise description of what you want to happen.

Please include an example where applicable: Ex 1:

$$
\text{Hello}
$$

Becomes

$$\text{Hello}$$

Ex 2:

$$\begin{gathered} s^2 Y(s)+s y(s)+5 Y(s)=s^2 X(s)-2 \times X(s)+X(s) \\ H(s)=\frac{Y(s)}{X(s)}=\frac{s^2-2 s+1}{s^2+s+5} \end{gathered} $$

Becomes

$$\begin{gathered} s^{2} Y(s)+s y(s)+5 Y(s)=s^{2} X(s)-2 \times X(s)+X(s) \\ H(s)=\frac{Y(s)}{X(s)}=\frac{s^{2}-2 s+1}{s^{2}+s+5}\end{gathered}$$

Describe Alternatives You've Considered

A clear and concise description of any alternative solutions or features you've considered. similar solutionto https://github.com/conneroisu/mathjax-linter

Additional Context

Add any other context or screenshots about the feature request here. I would be willing to create a pr if this feature is determined to be in scope.

pjkaufman commented 1 month ago

Hey @conneroisu . I am not sure I fully follow what is going on in the above and what Linter rules are being proposed. I am definitely open to math rules being added, I just want to make sure I understand exactly what is being proposed.

The first example provided has me a bit wary because it conflicts with the rule to move math block indicators onto their own lines. However, so long as the math format in question abides by the format that remark's math parser understands, I am willing to consider the math rules.

So if you could elaborate a little more on what exactly you are hoping the format for math blocks (inline or regular) would be, that would be very helpful in understanding which desired math formatting rules would be accepted and which do not fall under the remark math spec which would cause other logic to fail.

pjkaufman commented 1 month ago

I am not seeing the spec well from what I am seeing, but I think some of it lives on this page. But it works kind of like inline code and code blocks. So there is no ability to have text after the ending indicator for multiline math blocks. Also, if I recall it expects there to be some kind of content between two math blocks. Otherwise they are considered to be the same. So keep that in mind.

I am definitely willing to help with any questions or feedback around the development process.

pjkaufman commented 1 month ago

If it helps, here is a previous issue around adding formatting to math blocks: https://github.com/platers/obsidian-linter/issues/261. I meant to get to it, but other priorities came up.