[BUG] LaTeX math changed upon note review

This issue has been tracked since 2022-11-09.

Describe the bug
If using LaTeX math with $$ above a horizontal divider (---), the $$ is replaced with $ upon note review, i.e. $$ \int_{0}^{100}x^{2} $$ becomes $ \int_{0}^{100}x^{2} $

This appears to be caused by two bugs:

  1. SCHEDULING_INFO_REGEX matching until the last --- in the file.
    • Changing it from /^---\n((?:.*\n)*)sr-due: (.+)\nsr-interval: (\d+)\nsr-ease: (\d+)\n((?:.*\n)*)---/; to /^---\n((?:.*\n)*)sr-due: (.+)\nsr-interval: (\d+)\nsr-ease: (\d+)\n((?:.*\n)?)---/; matches only until the next --- and does not cause this issue
  2. All occurrences of $$ in the front matter are replaced with $

To Reproduce

  1. Write a note using LaTeX math with $$ to open and close the block
  2. Add a horizontal divider (---) below the math block
  3. Add the #review tag to the note
  4. Review note as easy, good, or hard
  5. All occurrences of $$ before the last --- will have been replaced with $

Expected behavior
No text outside of the scheduling info/flashcard info will be changed by the plugin.

Versions:

  • OS: Linux (Debian 10)
  • Obsidian version: v.1.0.3, installed through flatpak
  • Plugin version: v1.8.0
  • IInstaller version: '5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) obsidian/1.0.3 Chrome/100.0.4896.160 Electron/18.3.5 Safari/537.36'

Additional context
Reviewing this note will cause the issue for the first math block, but not the second:

---
sr-due: 2022-11-10
sr-interval: 1
sr-ease: 140
---

This is some text.

---

This math will be changed

$$ \int_{0}^{100}x^{2} $$

---

This math will be fine

$$ \int_{0}^{100}x^{2} $$


#review 
AB1908 wrote this answer on 2022-12-08

Since you've found the root cause, do you want to attempt fixing it? I am happy to provide some feedback/guidance if you need it.

st3v3nmw wrote this answer on 2022-12-30

Fix was merged, should be available in the next release

More Details About Repo
Owner Name st3v3nmw
Repo Name obsidian-spaced-repetition
Full Name st3v3nmw/obsidian-spaced-repetition
Language TypeScript
Created Date 2021-01-30
Updated Date 2023-03-19
Star Count 817
Watcher Count 9
Fork Count 94
Issue Count 174

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date