No description
Find a file
2026-07-14 00:12:49 +08:00
.github/workflows update relsease.yml 2026-03-16 18:52:42 +08:00
assets feat: optimize some display options and update README 2024-05-10 21:09:04 +02:00
fonts feat: basic impelement, still some bugs to be fixed 2024-04-28 21:15:01 +02:00
src fix: Fix menu dismissal blocking MathLive item clicks 2026-07-13 23:59:28 +08:00
.editorconfig Initial commit 2024-04-26 20:37:46 +02:00
.gitignore Add AGENTS.md and update .gitignore 2026-07-11 21:16:20 +08:00
.npmrc Initial commit 2024-04-26 20:37:46 +02:00
AGENTS.md feat: Add menu-outside-click dismissals for MathLive shadow-DOM menus 2026-07-13 22:16:14 +08:00
esbuild.config.mjs update to mathlive 0.108.3 2026-02-17 17:35:32 +08:00
eslint.config.mjs Migrate ESLint configuration to flat config format 2026-07-12 23:15:53 +08:00
LICENSE update LICENSE 2024-05-11 23:51:11 +02:00
manifest.json Bump version to 0.4.3 2026-07-14 00:12:49 +08:00
package.json Bump version to 0.4.3 2026-07-14 00:12:49 +08:00
pnpm-lock.yaml Update dependencies to latest mathlive and obsidian versions 2026-07-11 21:42:16 +08:00
README.md fix: Prevent MathLive widget disconnect during menu callbacks 2026-07-13 21:54:55 +08:00
styles.css feat: Debounce settings save and centralize JSON5 parsing 2026-07-12 23:43:35 +08:00
tsconfig.json update to mathlive 0.108.3 2026-02-17 17:35:32 +08:00
version-bump.mjs update to mathlive 0.108.3 2026-02-17 17:35:32 +08:00
versions.json update to mathlive 0.108.3 2026-02-17 17:35:32 +08:00

MathLive in Editor Mode

MathLive input in obsidian editor mode.

Features

  • Basic input function
  • Toggle mathlive display (global, block or inline)
  • Macro (sort of), shortcuts and keybindings support
  • Switch between mathlive and builtin mathjax
  • Place inline MathLive before or after the source equation
  • Different display modes

Usage

example.gif

Edit the equation in mathlive block below the latex display block.

It is also possible to assign a hotkey to toggle the display of mathlive block.

Macro settings

When the MathLive macros setting is set, the new command is available in MathLive widgets but not in builtin mathjax block due to some designs of mathjax.

If you want the new command to also show up in builtin mathjax block, you can use the copy button in MathLive macros to copy latex \newcommand command, then paste it in mathjax block in every page or use a plugin to preload those new commands.

Bugfix TODO

  • Input issue in tablet/phone
  • Keep focus and immediate MathJax refresh with the inline MathLive field on the right. The current implementation is experimental and depends on internal editor behavior described below.

The Inline MathLive position setting selects Left or Right. Left is the default for compatibility and uses the normal CodeMirror update path. Right enables the experimental focus-preservation path.

Non-public APIs

The plugin currently uses two groups of members that are absent from their public API declarations:

  • For right-side inline widgets and block widgets whose following cursor shares the decoration position, src/mathlive-input-sync.ts writes CodeMirror's private EditorView.inputState.composing property while MathLive is focused and around its transactions. Public CodeMirror exposes the read-only EditorView.composing getter, but does not expose inputState or a setter. Access is feature-detected; blur restores the focus-lifetime value, and each transaction also restores its previous value in finally.
  • src/setting.ts uses Obsidian settings internals to open and filter the Hotkeys tab: app.setting, openTabById(), activeTab, activeTab.headerComponent.components, and activeTab.updateHotkeyVisibility(). These members are absent from the official Obsidian API. The positional component lookup is especially fragile.

No non-public MathLive method is currently called. window.mathVirtualKeyboard, Mathfield methods/events, Obsidian renderMath()/finishRenderMath(), and Obsidian's typed global DOM/string helpers are public APIs. DOM queries, CSS selectors, shadow-DOM access, and DOM mutation are implementation techniques rather than non-public method calls, so they are not classified as non-public APIs here.

After updating Obsidian or CodeMirror, manually verify continuous inline input, same-line block trailing-text navigation, focus retention, MathLive menu selection/dismissal, immediate source/MathJax updates, and the Set hotkey button. pnpm build cannot detect private-member changes.