SupSub

by Wjgoarxiv
5
4
3
2
1
Score: 63/100

Description

Category: Note Enhancements

The SupSub plugin provides an easy way to format text with superscript and subscript tags within Obsidian notes. Users can quickly apply or remove <sup> and <sub> tags through hotkeys or a popup interface, making it convenient to adjust formatting on the fly. The plugin dynamically adjusts its options based on the current text formatting, offering only relevant actions like adding or removing superscript or subscript styles. Enhanced with user-friendly labels and conditional displays, the plugin ensures smooth and intuitive formatting workflows.

Reviews

No reviews yet.

Stats

13
stars
14,338
downloads
0
forks
1,023
days
81
days
81
days
0
total PRs
0
open PRs
0
closed PRs
0
merged PRs
10
total issues
1
open issues
9
closed issues
9
commits

Latest Version

3 months ago

Changelog

Bug Fixes

  • Fixed Decoration Ordering Crash: Replaced RangeSetBuilder with Decoration.set(ranges, true) to eliminate "Ranges must be added sorted" console errors on edge cases.
  • Fixed Cursor Placement After Wrapping: Cursor now correctly lands inside the tags (before closing tag) instead of at end of line. Uses requestAnimationFrame for stable positioning after decoration reflow.
  • Fixed Normal Button Not Appearing: Selecting superscripted/subscripted content with hidden tags now reliably shows the "Normal (n)" button via overlap detection.
  • Fixed Double-Wrapping: Partial tag selections no longer produce malformed <sup><sup>2</sup></sup>. The plugin detects overlapping tags and unwraps instead.

Improvements

  • Position-Aware Unwrapping: Unwrap logic scans the raw line for tags at the cursor position rather than relying on exact selection text. Handles all cases where hidden decorations cause visual-to-raw coordinate mismatches.
  • Cursor Line Tag Visibility: Tags are shown on the cursor line (matching Obsidian's native bold/italic behavior), allowing direct editing when needed.

README file from

Github

SupSub

Obsidian Plugin

SupSub is an Obsidian plugin that allows you to easily format selected text with <sup> and <sub> tags, enabling quick superscript and subscript formatting in your notes.

Usage

  • Superscript:

    • Hotkey: Option + Command + '=' on macOS or Ctrl + Alt + '=' on Windows.
    • With selection: Wraps the selected text with <sup> tags.
    • Without selection: Activates superscript typing mode — a status bar indicator ("SUP") appears and everything you type is formatted as superscript. Press Escape to exit.
    • Button: Sup (ⁿ)
  • Subscript:

    • Hotkey: Option + Command + '-' on macOS or Ctrl + Alt + '-' on Windows.
    • With selection: Wraps the selected text with <sub> tags.
    • Without selection: Activates subscript typing mode — a status bar indicator ("SUB") appears and everything you type is formatted as subscript. Press Escape to exit.
    • Button: Sub (ₙ)
  • Remove Formatting:

    • Action: Removes existing <sup> or <sub> tags from the selected text.
    • Button: Normal (n)
    • With hidden tags: When the "Hide Tags" setting is enabled, simply select the visible superscripted/subscripted text and hold the modifier key — the "Normal (n)" button appears automatically, even if your selection doesn't perfectly match the raw tag boundaries.
  • Toggling:

    • If the selected text is already wrapped in <sup> or <sub>, using the respective button or hotkey will remove the tags.
    • The plugin uses position-aware detection: as long as your cursor or selection overlaps any part of a tag, it will correctly unwrap instead of double-wrapping.
  • Popup Modifier Key:

    • By default, the popup buttons only appear when holding Cmd (macOS) or Ctrl (Windows/Linux) while selecting text.
    • Change the modifier key in Settings > SupSub > Popup Modifier Key.
    • Set to None to restore the previous always-show behavior.

Example Workflow

  1. Add Superscript/Subscript:

    • Select the text you want to format.
    • Click the Sup (ⁿ) or Sub (ₙ) button in the popup, or use the designated hotkeys.
    • The selected text will be wrapped with the corresponding tags, and the popup will disappear.
  2. Remove Superscript/Subscript:

    • Select the text that is already formatted with <sup> or <sub> tags.
    • Click the Normal (n) button in the popup.
    • The tags will be removed, the text will be reverted to normal formatting, and the popup will disappear.
  3. Remove Formatting with Hidden Tags:

    • With Hide Tags enabled, tags are invisible — you only see the styled content.
    • Select the visible superscripted/subscripted text and hold the modifier key (Cmd/Ctrl).
    • The popup shows Normal (n) — click it to remove the tags.
    • No need to select the exact raw tag boundaries; any overlapping selection works.

Contributing

Contributions are welcome! If you encounter any issues or have suggestions for improvements, please open a new issue or submit a pull request in the GitHub repository.

License

This plugin is licensed under the MIT License.


Changelog

Version 1.1.1 (@2026-02-18)

  • Bug Fixes:

    • Fixed Decoration Ordering Crash: Replaced RangeSetBuilder with Decoration.set(ranges, true) to eliminate "Ranges must be added sorted" console errors on edge cases.
    • Fixed Cursor Placement After Wrapping: After wrapping text with sup/sub, the cursor now correctly lands inside the tags (before the closing tag) instead of at the end of the line. Uses requestAnimationFrame to ensure stable positioning after decoration reflow.
    • Fixed Normal Button Not Appearing: When tags are hidden by decorations, selecting superscripted/subscripted content now reliably shows the "Normal (n)" button. Uses overlap detection instead of strict containment, so imprecise selections still work.
    • Fixed Double-Wrapping: Selecting text that partially overlaps existing tags no longer produces malformed output like <sup><sup>2</sup></sup>. The plugin detects overlapping tags and unwraps instead of double-wrapping.
  • Improvements:

    • Position-Aware Unwrapping: The unwrap logic now scans the raw line for tags at the cursor position rather than relying on exact selection text. This handles all cases where hidden decorations cause visual-to-raw coordinate mismatches.
    • Cursor Line Tag Visibility: Tags are now shown on the line where the cursor is (matching Obsidian's native behavior for bold/italic), allowing direct editing when needed.

Version 1.1.0 (@2026-02-17)

  • Bug Fixes:

    • Fixed Tag Hiding Rendering: Switched from Decoration.mark() with display: none to Decoration.replace() for hiding <sup>/<sub> tags. This eliminates cursor position mismatches that caused letters to disappear when typing near formatted text.
    • Fixed Text Shifting: Removed display: inline-block and position: relative CSS properties from superscript/subscript elements that were causing text to shift positions during editing.
    • Fixed Hide Tags Toggle: The "Hide Tags" setting now properly toggles on and off without requiring a restart.
    • Performance Optimization: Decoration computation now only processes visible ranges instead of the entire document.
  • New Features:

    • Modifier Key for Popup: The popup buttons now require holding a modifier key (Cmd/Ctrl by default) while selecting text. This prevents accidental popup appearances during normal text navigation. Configurable in Settings with options: Cmd/Ctrl, Ctrl, Shift, Alt, or None (legacy behavior).
    • Toggle Typing Mode: Activate superscript or subscript mode without selecting text first. Place your cursor and press the hotkey — a status bar indicator appears and everything you type is automatically formatted. Press Escape to exit. Supports toggling between modes and auto-exits on line change.

Version 1.0.5 (@2025-05-19)

  • Bug Fixes:
    • Fixed Text Shifting Issue: Resolved an issue where superscript and subscript text would shift positions when editing text in rows above.
    • Fixed Disappearing Text: Fixed a problem where letters would disappear when typing near superscript or subscript content.
    • Improved Decoration Handling: Enhanced the way hidden tags are managed to ensure consistent editing experience.

Version 1.0.4 (@2024-12-03)

  • Bug Fixes:

    • Resolved Selection Error: Fixed an issue where enabling the popup buttons and using the Sup or Sub buttons could cause a TypeError related to invalid selection points. The plugin now correctly validates selection ranges to prevent errors.
  • Improved Stability:

    • Enhanced compatibility with the latest Obsidian updates by refining editor integrations and ensuring seamless functionality.

Version 1.0.3 (@2024-12-01)

  • Enhanced Button Labels: Updated the popup buttons to be more user-friendly:
    • Sup (ⁿ): Wraps the selected text with <sup> tags.
    • Sub (ₙ): Wraps the selected text with <sub> tags.
    • Normal (n): Removes existing <sup> or <sub> tags from the selected text.
  • Conditional Button Display:
    • When the selected text is already wrapped in <sup> or <sub>, only the Normal (n) button is displayed to allow easy removal of the tags.
    • When the selected text is not wrapped, both Sup (ⁿ) and Sub (ₙ) buttons are available for formatting.

Similar Plugins

info
• Similar plugins are suggested based on the common tags between the plugins.
Advanced Tables
6 years ago by Tony Grosinger
Improved table navigation, formatting, and manipulation in Obsidian.md
Admonition
5 years ago by Jeremy Valentine
Adds admonition block-styled content to Obsidian.md
cMenu
5 years ago by Chetachi
An Obsidian.md plugin that adds a minimal text editor modal for a smoother writing/editing experience ✍🏽.
Smart Typography
5 years ago by mgmeyers
Converts quotes to curly quotes, dashes to em dashes, and periods to ellipses
Markdown Formatting Assistant
5 years ago by Reocin
This Plugin provides a simple WYSIWYG Editor for Markdown and in addition a command line interface. The command line interface facilitate a faster workflow.
Table Extended
5 years ago by AidenLx
Extend basic table in Obsidian with MultiMarkdown table syntax
Heading Level Indent
3 years ago by svonjoi
obsidian plugin for hierarchical structuration of document content based on heading levels
Change Case
3 years ago by David Brockman
Plugin to let you change the case (camelCase, snake_case, etc) of the current selection.
Paste Mode
5 years ago by Jacob Levernier
Obsidian Notes plugin for pasting text and blockquotes to the cursor's current level of indentation.
Code block from selection
5 years ago by Dmitry Savosh
Obsidian plugin. Adds code block for the selected text.
Callout Integrator
3 years ago by
A plugin for Obsidian to allow the integration of long blocks of text into callouts.
Wrap with shortcuts
4 years ago by Manic Chuang
Wrap selected text in custom tags with shortcuts.
Auto pair chinese symbol
5 years ago by renmu123
中文符号自动补齐
Inline spoilers
2 years ago by logonoff
Adds Discord-like syntax for inline spoilers.
Ordered List Style
4 years ago by erykwalder
Writing
3 years ago by johackim
Write and format your next book directly from Obsidian
Multi-line Formatting
5 years ago by nmady
Format Obsidian text over an entire selection, even if that selection has paragraph breaks in the middle!
Extended Markdown Syntax
a year ago by Kotaindah55
Extend your Markdown syntax using delimiters instead of HTML tags, such as underlining, superscript, subscript, highlighting, and spoiler.
Format Hotkeys
5 years ago by Ansel Santosa
Google Docs style formatting hotkeys for Obsidian
Remove Newlines
2 years ago by Elias Jaffe
A plugin for Obsidian.md which removes newlines and blank lines from selected or pasted text.
Formatto
2 years ago by Deca
Simple, fast, and easy-to-use Obsidian Markdown formatter.
Autocorrect Formatter
2 years ago by b-yp
A plugin running on Obsidian that utilizes autocorrect to format Markdown content.
Toggle Case
3 years ago by automattech
Obsidian plugin to toggle between `lowercase` `UPPERCASE` and `Title Case`
ObsidianTweaks
4 years ago by Jeppe Klitgaard
A plugin that implements a number of tweaks that should've been native to Obsidian.
Interlinear Glossing
3 years ago by Mijyuoon
An Obsidian plugin for interlinear glosses used in linguistics texts.
Blockquote Levels
4 years ago by Carlo Zottmann
A plugin for Obsidian (https://obsidian.md) that adds commands for increasing/decreasing the blockquote level of the current line or selection(s).
LaTeX to unicode converter
3 years ago by fjdu
Convert LaTeX commands into unicode sequences
Paste Reformatter
a year ago by Keath Milligan
A plugin for Obsidian that reformats pasted HTML and plain text content, giving you precise control over how content is transformed when pasted into your notes.
Callout Toggles
2 years ago by Aly Thobani
An Obsidian plugin to quickly add, change, or remove callout wrappers in your notes.
Auto-\displaystyle Inline Math
2 years ago by Ryota Ushio
An Obsidian.md plugin to automatically make all inline maths \displaystyle.
Text Conversions
3 years ago by Juan D Frias
Text conversions for Obsidian
Pandoc Extended Markdown
3 months ago by ErrorTzy
This plugin enables Obsidian to render Pandoc extended markdown lists, and adds useful sidebar for lists and footnotes
heti
2 years ago by Moeyua
Canvas Format Brush
a year ago by wenlzhang
An Obsidian plugin that allows you to copy and paste formatting attributes (size and color) between canvas elements, similar to the format painter in Word.
Image Size
a year ago by Jie Zhang
Set the default size for pasted images.
Jisage -Japanese Indentation-
2 years ago by Telehakke
Obsidian plugin.
复制图文 (Copy Image Text)
2 years ago by msgk
obsidian插件,复制笔记内容(包括文本和图片)到剪贴板
Image Helper
2 years ago by Chongmyung Park
Context menu to convert a image to another format in reading view in Obsidian.md
Better Order List
2 years ago by Boninall
Discord Timestamps
a year ago by Erika Gozar
Displays discord timestamps in read mode as they would appear in Discord.
Heading Toggler
2 years ago by Lord Turmoil
Toggle heading levels in Obsidian
Chat clips
a year ago by sleepingraven
Record chat in ordinary markdown list.
Keyboard Formatter
8 months ago by Lauloque
Formats keyboard text (kbd) in your Obsidian notes quickly and consistently.
Vim Marker Sharpener
a year ago by Artem Dvoryadkin
Text formatting commands in Vim mode. Supports applying styles (bold, italic, etc.). Works correctly in visual mode with selected text.
Note Placeholder
a year ago by XZSt4nce
Replaces text of note link to placeholder in view mode.
Bottom to Top
a year ago by Henry Gustafson