Activity

  Benjamin Davies addressed criticism #3259.

I haven’t used Obsidian, so I don’t understand what you are requesting. Is it that, whenever you open a bracket, you want the closing bracket to appear automatically?

#3259·Dennis HackethalOP, 8 days ago

I’ve asked Gemini to explain it:

1. Auto-Closure (Insertion State)

When the user inputs an opening delimiter, the system immediately injects the corresponding closing delimiter and places the caret (cursor) between them.

Input: (

Buffer State: (|)

Logic: insert(openingchar) + insert(closingchar) + move_caret(-1)

2. Type-Through (Escape State)

If the caret is positioned immediately before a closing delimiter that was autopaired, and the user types that specific closing delimiter, the system suppresses the character insertion and instead advances the caret.

Context: [text|]

Input: ]

Buffer State: [text]| (Not [text]])

Logic: if (nextchar == inputchar) { movecaret(+1); preventdefault(); }

3. Atomic Deletion (Regression State)

If the caret is between an empty pair of delimiters, a backspace event deletes both the opening and closing characters simultaneously, returning the buffer to the pre-insertion state.

Context: (|)

Input: Backspace

Buffer State: |

Logic: if (prevchar == open && nextchar == close) { delete_range(caret-1, caret+1); }

4. Selection Wrapping (Transformation State)

If a text range is selected (highlighted) and an opening delimiter is typed, the system wraps the selection rather than replacing it.

Context: |selected_text|

Input: [[

Buffer State: [[selected_text]]

Logic: surroundselection(inputpair)

5. Markdown-Specific Heuristics

Obsidian applies context-aware logic for Markdown syntax (e.g., * or _). It often checks word boundaries to determine if the user intends to bold/italicize or use a bullet point.

Context (Start of line): | + * + Space -> Bullet list (autopair disabled/consumed by formatting).

Context (Middle of line): word | + * -> word | (autopair enabled for italics).