widcardw / obsidian-asciimath

Asciimath support for Obsidian (based on asciimath-parser)
MIT License
29 stars 3 forks source link

Insert newline into asciimath block #5

Closed nikp123 closed 1 year ago

nikp123 commented 1 year ago

Apologies if this question may seem dumb but is there a way (in the current version of the plugin) to insert newlines in the asciimath block.

Example: (triple tilda)asciimath a = b c = d (triple tilda)

Thanks in advance

widcardw commented 1 year ago

Oops, this problem is also mentioned by my friend @zmx0142857, and I am also considering whether to use several line breaks as a sign of aligned environment.

The current solution should be like

```am
& a = b
            <-- a blank line here
& c = d
```

For more information, please refer to https://asciimath.widcard.win. If users are really complaining about this problem, I'll fix it in the next version of asciimath-parser.

nikp123 commented 1 year ago

Oh thanks, that solves my problem.

So adding ampersand before the line indicates that the line is "alone" so to speak?

widcardw commented 1 year ago

In the code generation stage, asciimath-parser will find if there is any & in the root node of ast. If there is no &, then the result won't be wrapped with aligned environment. Meanwhile, \\ as the line break only works in aligned environment (in KaTeX or mathjax). That's it.