Search...Search plugins and themes...
⌘K
Sign in
  • Get started
  • Download
  • Pricing
  • Enterprise
  • Account
  • Obsidian
  • Overview
  • Sync
  • Publish
  • Canvas
  • Mobile
  • Web Clipper
  • CLI
  • Learn
  • Help
  • Developers
  • Changelog
  • About
  • Roadmap
  • Blog
  • Resources
  • System status
  • License overview
  • Terms of service
  • Privacy policy
  • Security
  • Community
  • Plugins
  • Themes
  • Discord
  • Forum / 中文论坛
  • Merch store
  • Brand guidelines
Follow us
DiscordTwitterBlueskyThreadsMastodonYouTubeGitHub
© 2026 Obsidian

LaTeX Inline Block Toggle

frank-smithfrank-smith24 downloads

Toggle LaTeX math between inline and display blocks, and merge consecutive block formulas.

Add to Obsidian
  • Overview
  • Scorecard
  • Updates1

Repository · Releases · Changelog

Convert LaTeX math between inline ($...$) and display block ($$...$$) styles directly in the Obsidian editor.

Features

  • Two editor commands:
    • Toggle math inline/block
    • Merge consecutive block formulas
  • Commands are registered through Obsidian's official command system so users can set their own hotkeys.
  • Both actions are available in the editor right-click context menu (configurable).
  • Selection-aware behavior:
    • If text is selected, conversion runs on the selection.
    • Without a selection, toggle converts the block at the cursor to inline math, or all inline formulas on the current line to blocks.
    • Merge combines adjacent blocks into an aligned environment.
  • Friendly Notice messages when conversion cannot be safely performed.
  • Settings for context menu visibility and whitespace trimming. Block output is multiline.

Demo (Text)

Block to inline

Input:

$$
\lim_{n \to \infty} a_n = L.
$$

Output:

$\lim_{n \to \infty} a_n = L.$

Inline to block

Input:

$\lim_{n \to \infty} a_n = L.$

Output (multiline block):

$$
\lim_{n \to \infty} a_n = L.
$$

Installation (Manual Sideload)

  1. Download main.js, manifest.json, and styles.css from the latest release, or build the plugin (see below).
  2. Create a folder in your vault:
    • .obsidian/plugins/latex-inline-block-toggle/
  3. Copy these files into that folder:
    • main.js
    • manifest.json
    • styles.css
  4. In Obsidian:
    • Open Settings -> Community plugins
    • Disable Safe mode (if needed)
    • Enable LaTeX Inline Block Toggle

Compatibility

The minimum app version remains 1.5.0, on desktop and mobile. On 1.13+, the two settings use Obsidian's declarative API for settings search; older versions use the existing settings UI. Command IDs and setting keys are unchanged by the API update. External settings reload is available on 1.5.7+.

If upgrading from the old obisian-latex-inline-block-toggle ID, disable the old plugin first. Keep a copy of its data.json, install into the new folder above, and copy that file into it before enabling. The earlier ID rename changes Obsidian's command namespace, so reassign custom hotkeys to the new plugin. Do not enable both copies.

See official API references and validation notes.

Development Setup

  1. Clone this repository.
  2. Install dependencies:
npm ci
  1. For development watch mode:
npm run dev
  1. For a production build:
npm run build

Run npm run typecheck and npm test to check types and run the lightweight regression suite (no extra test dependencies).

Build Instructions

  • npm run dev:
    • Watches main.ts and rebuilds main.js on changes.
  • npm run build:
    • Creates a production bundle (main.js).
  • npm run version:
    • Updates versions.json using manifest.json values.

How Commands Work

Toggle math inline/block

Select an inline expression or a block to convert it. Without a selection, the command converts the block at the cursor to inline math; otherwise it converts inline expressions on the current line into separate multiline blocks. Block-to-inline conversion can join neighboring text lines with matching quote prefixes.

Output format

Inline-to-block conversion always places the opening and closing $$ delimiters on separate lines. For example, $formula$ becomes:

$$
formula
$$

Block-to-inline conversion flattens line breaks and produces $formula$. Existing single-line display blocks are also accepted as input:

$$ formula $$

Toggling this block produces $formula$ with the default whitespace trimming setting. Toggling it again produces the multiline block shown above. There is no setting to generate single-line display blocks.

Merge consecutive block formulas

Select consecutive blocks, or place the cursor in one of them, to merge the group into a single aligned block. Intervening text prevents merging.

Settings

Open Settings -> Community plugins -> LaTeX Inline Block Toggle:

  • Show commands in editor context menu (default: true)
    • Show/hide the conversion actions in the editor right-click menu.
  • Trim surrounding whitespace when converting (default: true)
    • Trims extracted math content during conversion.

Edge Cases and Limitations

  • Inline detection is intentionally restricted to the current line.
  • Escaped dollar signs (\$) are not treated as delimiters.
  • The plugin distinguishes single-dollar and double-dollar delimiters.
  • Heuristics are used to avoid obvious currency false positives, but not every ambiguous case can be perfectly inferred.
  • Malformed or deeply ambiguous delimiter patterns are safely rejected with a notice.
  • Fenced math blocks like ```math are not supported (by design).
  • This plugin does not implement a full LaTeX parser.

License

MIT. See LICENSE.

HealthExcellent
ReviewSatisfactory
About
Toggle LaTeX math between inline ($...$) and display block ($$...$$) directly in the editor, operating on selection, the current line, or the block at the cursor. Merge consecutive block formulas into an aligned environment. Show warnings when conversion can’t be safely performed.
LaTeXEditingCommands
Details
Current version
0.2.0
Last updated
2 weeks ago
Created
6 months ago
Updates
1 release
Downloads
24
Compatible with
Obsidian 1.5.0+
Platforms
Desktop, Mobile
License
MIT
Report bugRequest featureReport plugin
Author
frank-smithfrank-smith
GitHubjm-frank
  1. Community
  2. Plugins
  3. LaTeX
  4. LaTeX Inline Block Toggle

Related plugins

Sort and Permute lines

Sort and Permute lines in whole file or selection.

Heading Shifter

Easily Shift and Change Markdown headings.

Paste URL into selection

Paste URL "into" selected text.

Keyshots

Add classic hotkey/shortcuts commands from popular IDEs like Visual Studio Code or JetBrains Family.

Vimrc Support

Auto-load a startup file with Vim commands.

Code Editor Shortcuts

Add keyboard shortcuts (hotkeys) commonly found in code editors such as Visual Studio Code (VS Code) or Sublime Text.

LanguageTool Integration

Advanced grammar and spell checking, powered by LanguageTool.

Meta Bind

Make your notes interactive with inline input fields, metadata displays, and buttons.

Quick Switcher++

Enhanced Quick Switcher, search open panels, and symbols.

Advanced Tables

Improved table navigation, formatting, and manipulation.