Skip to content

Commit 723f2fb

Browse files
committed
feat: adds admonition importing
1 parent 2fb38cc commit 723f2fb

File tree

3 files changed

+391
-111
lines changed

3 files changed

+391
-111
lines changed

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,51 @@ Want to add an existing icon pack? Make a pull request with the following:
436436

437437
This button will generate a CSS snippet that you can save and use for your custom callout types.
438438

439+
## Importing Custom Admonitions
440+
441+
Custom admonitions can be imported in settings from a JSON array of definitions.
442+
443+
At a _minimum_, you only need a valid admonition type:
444+
445+
```json
446+
[
447+
{
448+
"type": "my-custom-type"
449+
}
450+
]
451+
```
452+
453+
This will use the `pencil-alt` FontAwesome icon and a random color, and set all other properties as false.
454+
455+
However, you can specify an icon and color as well:
456+
457+
```json
458+
[
459+
{
460+
"type": "my-custom-type",
461+
"icon": "globe",
462+
"color": "120,120,120"
463+
}
464+
]
465+
```
466+
467+
If you want to specify an icon pack, you can do so like this:
468+
469+
```json
470+
[
471+
{
472+
"type": "my-custom-type",
473+
"icon": {
474+
"name": "globe",
475+
"type": "font-awesome"
476+
},
477+
"color": "120,120,120"
478+
}
479+
]
480+
```
481+
482+
All of the possible fields are defined [here](https://github.com/valentine195/obsidian-admonition/blob/2fb38ccc0b39ada8d3d0a4476e9ff3333c52c3ae/src/%40types/index.d.ts#L5).
483+
439484
## Admonition Settings
440485

441486
Settings specific to admonitions are managed in this section.

0 commit comments

Comments
 (0)