Skip to content

Normalize admonition type to lowercase#371

Merged
ebullient merged 1 commit intomainfrom
claude/brave-joliot
Mar 28, 2026
Merged

Normalize admonition type to lowercase#371
ebullient merged 1 commit intomainfrom
claude/brave-joliot

Conversation

@ebullient
Copy link
Copy Markdown
Owner

@ebullient ebullient commented Mar 28, 2026

Summary

  • Admonition types are now normalized to lowercase at save time (addAdmonition), since Obsidian lowercases data-callout when rendering callouts — a type stored as "Warning" would never match callout.dataset.callout === "warning".
  • validateType also normalizes before the duplicate check, so "Note" and "note" are treated as the same type.
  • A migration in loadSettings re-keys any existing uppercase types to their lowercase equivalents.

Closes #356 — went with normalization instead of rejection for better UX.

Test plan

  • Create an admonition with a mixed-case type (e.g. Warning) — it should be stored and render as warning
  • Try creating warning after Warning already exists — duplicate check should fire
  • Existing vault data with uppercase types should be migrated on load and render correctly
  • npm run build passes cleanly

🤖 Generated with Claude Code

Obsidian lowercases the data-callout attribute when rendering callouts,
so types with uppercase letters would fail the admonitions[type] lookup.
Instead of rejecting uppercase input, normalize to lowercase at storage
time (addAdmonition) and in validateType for correct duplicate detection.
Also migrate any existing uppercase types in userAdmonitions on load.

Closes #356
@ebullient ebullient merged commit 236a896 into main Mar 28, 2026
1 check passed
@ebullient ebullient deleted the claude/brave-joliot branch March 28, 2026 22:24
ebullient added a commit that referenced this pull request Apr 17, 2026
After the lowercase normalization migration (PR #371), notes with
mixed-case callout syntax (e.g. > [!Test]) fail to apply custom
admonition styling because data-callout preserves the original case
while settings keys and CSS selectors are now lowercase.

Fixes #388

Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant