AllanChain / logseq-live-math

Type LaTeX in live mode!
Apache License 2.0
35 stars 1 forks source link

Add option to determine display mode based on the current line #7

Closed chronos1970 closed 8 months ago

chronos1970 commented 9 months ago

As of now, changing the display mode is only possible with a mouse click (which takes a lot of time). It would be really nice if the extension can intelligently determine the display mode based on whether the math expression exists on an empty line or not.

AllanChain commented 9 months ago

That's a good idea! However, there are some cases where it's not easy to determine whether to use inline or display mode. When a math is added at the start of the line, the user can mean

$|x|$ is the absolute value of $x$

or

$$ I just want display math in a separate block $$

But in this case, I think inserting preferred format is sufficient.

I'll try the intelligence you suggested.

chronos1970 commented 9 months ago

I think in the context of Logseq (an outliner, where everything is a bullet list) new lines by default begin with a - (inline context) and new lines without a - (block context) should contain things related to the block like images, math blocks, tables, etc.. However, your point still stands. Perhaps adding a keyboard shortcut for toggling display modes in addition to this feature would cover all use cases.

Thanks for this amazing plugin and for your time on this feature.

AllanChain commented 8 months ago

https://github.com/AllanChain/logseq-live-math/releases/tag/v1.2.0 is released with smartFormat option and a Ctrl + $ shortcut to switch between display and inline mode.

Feel free to reopen this issue if it's not working for you.