@@ -29,8 +29,24 @@ content: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euism
2929
3030<img src =" https://i.imgur.com/pBTJAFa.png " >
3131
32+ Leave the title field blank to only display the admonition.
33+ ```` markdown
34+ ```note
35+ title:
36+ content: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod nulla.
37+ ```
38+ ````
39+
40+ <img src =" https://i.imgur.com/pNU2MB7.png " >
41+
3242** Please note that when the title is included, you _ must_ specificy the content as well.**
3343
44+ ### Collapsible
45+
46+ Use ` collapse: open ` or ` collapse: closed ` to create a collapsible admonition.
47+
48+ <img width =' 640px ' src =" https://thumbs.gfycat.com/UniqueVillainousHarpseal-size_restricted.gif " >
49+
3450## Admonition Types
3551
3652The following admonition types are currently supported:
@@ -54,7 +70,11 @@ See [this](https://squidfunk.github.io/mkdocs-material/reference/admonitions/) f
5470
5571## Customization
5672
57- The admonitions are each styled with with the following classes, which can be override to custom their appearance:
73+ This is all of the CSS applied to the admonitions. Override these classes to customize the look.
74+
75+ ### Base Classes
76+
77+ Every admonition receives the following CSS classes:
5878
5979``` css
6080.admonition {
@@ -66,7 +86,7 @@ The admonitions are each styled with with the following classes, which can be ov
6686 background-color : var (--background-secondary );
6787 border-left : 0.2rem solid ;
6888 border-radius : 0.1rem ;
69- box-shadow : var (--background-modifier-box-shadow );
89+ box-shadow : 0 0.2 rem 0.5 rem var (--background-modifier-box-shadow );
7090}
7191.admonition-title ::before {
7292 position : absolute ;
@@ -92,7 +112,9 @@ The admonitions are each styled with with the following classes, which can be ov
92112}
93113```
94114
95- Additionally, each admonition type will receive the ``` .admonition-<type> ``` class:
115+ ### Type Specific
116+
117+ Additionally, each admonition type will receive the ` .admonition-<type> ` class:
96118
97119``` css
98120/* Example of .admonition-note */
@@ -109,30 +131,89 @@ Additionally, each admonition type will receive the ```.admonition-<type>``` cla
109131}
110132```
111133
112- The admonition icons are svgs defined as variables on the ``` :root ``` with the name ``` --admonition-icon--<type> ``` . Override this variable to customize the icon. Example:
134+ #### Type Icons
135+
136+ The admonition icons are svgs defined as variables on the ` :root ` with the name ` --admonition-icon--<type> ` . Override this variable to customize the icon. Example:
137+
113138``` css
114139--admonition-icon--quote: url("data :image/svg + xml;charset=utf-8 ,<svg xmlns='http://www.w3 .org/2000/svg' viewBox='0 0 24 24'> <path d='M14 17h3l2-4V7h-6v6h3M6 17h3l2-4V7H5v6h3l-2 4z'/> </svg > ");
115140```
116141
142+ ### Collapsible
143+
144+ If an icon is collapsible, it will receive the following CSS:
145+
146+ ``` css
147+ details .admonition :not ([open ]) {
148+ padding-bottom : 0 ;
149+ box-shadow : none ;
150+ }
151+ details .admonition > summary {
152+ outline : none ;
153+ list-style : none ;
154+ display : block ;
155+ min-height : 1rem ;
156+ padding : 0.4rem 1.8rem 0.4rem 2rem ;
157+ border-top-left-radius : 0.1rem ;
158+ border-top-right-radius : 0.1rem ;
159+ cursor : pointer ;
160+ }
161+ details .admonition > summary ::-webkit-details-marker {
162+ display : none ;
163+ }
164+
165+ details .admonition > summary :after {
166+ position : absolute ;
167+ top : 8px ;
168+ right : 8px ;
169+ width : 20px ;
170+ height : 20px ;
171+ background-color : currentColor ;
172+ -webkit-mask-image : var (--admonition-details-icon );
173+ mask-image : var (--admonition-details-icon );
174+ -webkit-mask-repeat : no-repeat ;
175+ mask-repeat : no-repeat ;
176+ -webkit-mask-size : contain ;
177+ mask-size : contain ;
178+ transform : rotate (0deg );
179+ transition : transform 0.25s ;
180+ content : " " ;
181+ }
182+ details .admonition [open ] > summary :after {
183+ transform : rotate (90deg );
184+ }
185+ ```
186+
187+ ### No Title
188+
189+ An icon without a title will have this CSS:
190+
191+ ``` css
192+ .admonition-title.no-title {
193+ display : none ;
194+ }
195+ ```
196+
117197## Todo
118- - Add the ability to collapse the admonition
119- - Custom admonitions
120- - Settings tab to customize icon and color of included admonitions
121- - Longterm - ability to render markdown inside an admonition
198+
199+ - Add the ability to collapse the admonition
200+ - Custom admonitions
201+ - Settings tab to customize icon and color of included admonitions
202+ - Longterm - ability to render markdown inside an admonition
122203
123204## Installation
124205
125206### From GitHub
126- - Download the Latest Release from the Releases section of the GitHub Repository
127- - Copy the ` main.js ` , ` styles.css ` and ` manifest.json ` files from the release to your vault's plugins folder: ` <vault>/.obsidian/plugins/ `
128- Note: On some machines the ` .obsidian ` folder may be hidden. On MacOS you should be able to press ` Command+Shift+Dot ` to show the folder in Finder.
129- - Reload Obsidian
130- - If prompted about Safe Mode, you can disable safe mode and enable the plugin.
131- Otherwise head to Settings, third-party plugins, make sure safe mode is off and
132- enable the plugin from there.
133207
208+ - Download the Latest Release from the Releases section of the GitHub Repository
209+ - Copy the ` main.js ` , ` styles.css ` and ` manifest.json ` files from the release to your vault's plugins folder: ` <vault>/.obsidian/plugins/ `
210+ Note: On some machines the ` .obsidian ` folder may be hidden. On MacOS you should be able to press ` Command+Shift+Dot ` to show the folder in Finder.
211+ - Reload Obsidian
212+ - If prompted about Safe Mode, you can disable safe mode and enable the plugin.
213+ Otherwise head to Settings, third-party plugins, make sure safe mode is off and
214+ enable the plugin from there.
134215
135216## Warning
136217
137218This plugin comes with no guarantee of stability and bugs may delete data.
138- Please ensure you have automated backups.
219+ Please ensure you have automated backups.
0 commit comments