Skip to content

Reject uppercase in admonition type#356

Closed
almarouk wants to merge 1 commit intoebullient:mainfrom
almarouk:patch-1
Closed

Reject uppercase in admonition type#356
almarouk wants to merge 1 commit intoebullient:mainfrom
almarouk:patch-1

Conversation

@almarouk
Copy link
Copy Markdown

Pull Request Description

Uppercase letters shouldn't be allowed in admonition type. Otherwise, it will cause failure when checking if the callout/admonition is a custom one; for example in the following:
https://github.com/javalent/admonitions/blob/f19389940b0148b677e106f503980cbb9f767f63/src/callout/manager.ts#L57

Changes Proposed

  • Add an additional validation case that tests for uppercase.

Related Issues

Checklist

  • I have read the contribution guidelines and code of conduct.
  • I have tested the changes locally and they are working as expected.
  • I have added appropriate comments and documentation for the code changes.
  • My code follows the coding style and standards of this project.
  • I have rebased my branch on the latest main (or master) branch.
  • All tests (if applicable) have passed successfully.
  • I have run linters and fixed any issues.
  • I have checked for any potential security issues or vulnerabilities.

Reject uppercase in admonition type
ebullient added a commit that referenced this pull request Mar 28, 2026
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
Copy link
Copy Markdown
Owner

Thanks for the report and the fix! I've gone with normalization instead of rejection — admonition types are now automatically lowercased at save time, which is consistent with how Obsidian already lowercases the data-callout attribute. This also migrates any existing uppercase types on load. See #371 for the implementation.

@ebullient ebullient closed this Mar 28, 2026
ebullient added a commit that referenced this pull request Mar 28, 2026
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
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.

2 participants