Get AI summaries of any video or article — Sign up free
Critique your plugin #1 — Obsidian October 2024 thumbnail

Critique your plugin #1 — Obsidian October 2024

Obsidian·
6 min read

Based on Obsidian's video on YouTube. If you like this content, support the original creators by watching, liking and subscribing to their content.

TL;DR

Replace custom H1-based section headings with Obsidian’s standard setting-heading styling to match the app’s typography and spacing.

Briefing

Obligator’s settings UI needs to match Obsidian’s own design conventions, and the fastest wins come from small, concrete changes: removing redundant headings, using the API’s “setting heading” styling, and restructuring the page so related options sit together and appear only when they’re relevant. The critique zeroes in on how the settings tab currently feels “off” compared with the rest of Obsidian, then walks through a set of edits that bring the plugin into alignment—starting with the settings layout and then moving into the logic that decides what shows up.

The first round of fixes targets visual consistency. Obvious problems include large HTML H1 headings labeled “basic settings,” plus oversized “Archive” and “Advanced” headings created with H1 tags. The recommended approach is to remove redundant section titles entirely and replace custom headings with Obsidian’s standard setting-heading treatment via the API (using a “set heading” call rather than manually creating H1 elements). The critique also calls out naming redundancy—since the UI already lives inside the settings tab, repeating the word “settings” in labels wastes space.

Beyond styling, the settings page should behave intelligently. Two options—“initial heading” and “terminal heading”—are treated as always visible, even though they only make sense when a template file is configured. The suggested fix is to hide these settings unless the template path exists, by gating their rendering inside the display function behind a check for template path presence. The critique further notes that the UI must refresh when the template path changes: the code currently refreshes headings only when the path points to a file, but it should also re-render when the template is cleared or becomes invalid so the settings appear/disappear immediately.

Once the UI is cleaner, attention shifts to wording and toggle semantics in the “Advanced” section. Two toggles—“delete empty headings” and “don’t delete headings from template”—are both defaulted to on, but their phrasing creates cognitive friction because one toggle’s “on” means delete, while the other’s “on” means don’t delete. The critique recommends making toggle names affirmative so “on” consistently corresponds to the action being performed, either by renaming and inverting the toggle value or by changing the label to reflect the preserved behavior.

The review then moves from UI to code structure. The plugin class is relatively small, with most logic inside an onload routine that loads settings, defines a ribbon icon to open today’s daily note, and conditionally runs a “run obligator” function on startup. The critique suggests naming improvements (e.g., aligning the ribbon action name with what it actually opens) and highlights that validation is a strong point: the run function checks for missing note paths, verifies folders exist, and validates initial/terminal heading configuration.

Still, several improvements are proposed. Notices should include the plugin name to help users debug which plugin triggered them. For folder/file existence, newer Vault helpers (get file by path / get folder by path) can reduce type ambiguity. The code currently saves settings even when no changes occur, and it performs risky markdown parsing to confirm headings exist—an approach the critique flags as error-prone compared with using Obsidian’s metadata cache. Finally, there’s a feature request: open the daily note in a new tab when the ribbon is clicked with a modifier key. That would require passing a leaf type into getLeaf, derived from the click’s modifier state via keymap event handling, so behavior matches how users interact with Obsidian.

Overall, the critique frames plugin quality as a mix of UI conformity, correct reactive rendering, clear toggle semantics, and robust validation—plus small interaction upgrades that respect Obsidian’s navigation patterns.

Cornell Notes

Obligator’s settings and behavior can be improved with targeted changes that bring it in line with Obsidian’s UI standards and make configuration safer. The critique recommends removing redundant and oversized headings (especially H1-based ones) and using Obsidian’s setting-heading API styling. It also argues that “initial heading” and “terminal heading” should be hidden unless a template file path exists, with the settings page re-rendering whenever the template path changes. In the code, validation is a strength, but notices should identify the plugin, settings shouldn’t be saved when nothing changed, and markdown heading checks should avoid brittle parsing in favor of metadata cache. A final enhancement would open the daily note in a new tab when modifier-clicking the ribbon icon.

What specific UI changes make Obsidian plugin settings look and feel native?

The critique points to three concrete fixes: remove redundant section headings like “basic settings,” replace oversized HTML H1 headings (e.g., “Archive” and “Advanced”) with Obsidian’s standard setting-heading styling via the API (using a set heading call), and avoid repeating the word “settings” inside labels since the UI already sits in the settings tab. It also recommends following Obsidian’s published guide for settings-tab layout so spacing, typography, and hierarchy match the rest of the app.

Why should “initial heading” and “terminal heading” be hidden until a template file is configured?

Those options only apply when a template file exists. Keeping them visible when no template is set creates confusion and clutter. The suggested implementation gates their rendering in the display function behind a check that the template path exists, so the settings appear only after a template is selected and disappear immediately when the template is cleared.

What reactive behavior is required when the template path changes?

The settings UI must refresh whenever the template path is updated—not only when it points to a valid file. The critique notes the current logic refreshes headings only under a file check, so it should instead call the display function in more cases (including when the template becomes invalid or is removed) to ensure the settings page updates instantly.

How do toggle names affect user understanding in the “Advanced” section?

Two toggles are both defaulted to on, but their phrasing flips the meaning of “on.” “Delete empty headings” uses on = delete, while “don’t delete headings from template” uses on = don’t delete. The critique recommends rewriting toggles so they’re affirmative and consistent—either rename and invert the toggle value or rename the setting so the action matches the “on” state (e.g., “delete headings from template” with inverted logic, or “preserve headings from template” so on means preserve).

What are the main code-quality concerns raised inside run obligator?

Validation is praised, but several issues are flagged: notices should include the plugin name for easier debugging; settings should only be saved when validation actually changes something; folder/file existence checks can use newer Vault helpers (get file by path / get folder by path) to ensure correct types; and checking for initial/terminal headings by parsing markdown directly is brittle—metadata cache would be a safer source of heading information.

How could the ribbon click be enhanced to open the daily note in a new tab?

The critique proposes passing a leaf type into getLeaf so the note opens in the correct pane. It suggests deriving the leaf type from the click’s modifier state using keymap’s event handling (converting a mouse event into a leaf type like tab/window/split). Then the ribbon action would call run obligator with that leaf type so modifier-click behavior matches typical Obsidian navigation.

Review Questions

  1. Which settings UI elements should be removed or replaced to match Obsidian’s settings-tab conventions, and what API mechanism is used for the replacement?
  2. What conditions should control whether “initial heading” and “terminal heading” settings are rendered, and what must happen when the template path is cleared?
  3. Why is direct markdown parsing for heading validation considered risky, and what Obsidian feature is suggested as a more reliable alternative?

Key Points

  1. 1

    Replace custom H1-based section headings with Obsidian’s standard setting-heading styling to match the app’s typography and spacing.

  2. 2

    Remove redundant labels like “basic settings” and avoid repeating “settings” inside the settings tab UI.

  3. 3

    Render “initial heading” and “terminal heading” only when a template path exists, and re-render immediately when the template path changes or is cleared.

  4. 4

    Fix confusing toggle semantics by rewriting toggle names so the “on” state consistently corresponds to the described action, or invert the stored value to match the new wording.

  5. 5

    Add plugin-identifying context to user notices so debugging doesn’t require guessing which plugin triggered them.

  6. 6

    Avoid saving settings when validation doesn’t actually modify any values.

  7. 7

    Replace brittle markdown heading parsing with metadata cache-based validation, and consider modifier-aware ribbon behavior to open notes in new tabs.

Highlights

The biggest UI win is swapping H1 headings for Obsidian’s native setting-heading treatment via the API, eliminating layout inconsistency.
“Initial heading” and “terminal heading” should be gated behind template path existence and updated reactively when the template changes.
Toggle wording matters: two “on” toggles can mean opposite actions if one is phrased negatively, so labels should be made affirmative and consistent.
Direct markdown parsing to verify headings is flagged as error-prone; metadata cache is recommended for safer heading validation.
Modifier-click support for the ribbon can be implemented by passing a leaf type into getLeaf derived from keymap event handling.

Topics

  • Obsidian Plugin Critique
  • Settings UI Consistency
  • Toggle Wording
  • Reactive Settings Rendering
  • Metadata Cache Validation
  • Modifier Click Leaf Type