Veritula – Meta

Showing only #3171 and its comments.

See full discussion
  Log in or sign up to participate in this discussion.
With an account, you can revise, criticize, and comment on ideas.

Discussions can branch out indefinitely. Zoom out for the bird’s-eye view.
Benjamin Davies’s avatar
Benjamin Davies, 21 days ago·#3171

Obsidian autopairs markdown syntax and brackets. I like it a lot and would like Veritula to have something similar!

Criticized1Archived
Dennis Hackethal’s avatar

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?

Criticism of #3171
Benjamin Davies’s avatar
Benjamin Davies, revised by Dennis HackethalOP 6 days ago·#3372
2nd of 2 versions

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(opening_char) + insert(closing_char) + 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 (next_char == input_char) { move_caret(+1); prevent_default(); }

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 (prev_char == open && next_char == 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: surround_selection(input_pair)

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).

Criticism of #3259Criticized1
Dennis Hackethal’s avatar

I have implemented 1-4. Give it a try. I think 5 is out of scope for now but I may revisit it at some point. If auto-closing asterisks are a problem at the start of a line (when making lists), use a hyphen instead.

Criticism of #3372
Dennis Hackethal’s avatar
Dennis HackethalOP revised 6 days ago·#3397
2nd of 2 versions

I can take this opportunity to replace manual markdown with a proper text editor. Then there’s no need for autopaired brackets.

The editor will need to support:

  • Automatic links to ideas like #123
  • Links to @mentions like @dennis-hackethal
  • Safe link formatting
  • Disabling of turbo links
  • Namespaced footnotes
  • Custom blockquote format
  • Protection against XSS
  • Retention of formatting when pasting
Criticized1
Dennis Hackethal’s avatar

On second thought, implementing a proper text editor would take more work than I initially realized, and is far beyond the scope of what Benjamin is requesting anyway. I can revisit this idea later.

Criticism of #3397