@@ -68,7 +68,7 @@ The callout would be rendered as something like this:
68
68
</div >
69
69
<div class =" callout-title-text" >This is an error callout</div >
70
70
</div >
71
- <div >This is the content inside callout</div >
71
+ <div class = " callout-content " >This is the content inside callout</div >
72
72
</blockquote >
73
73
```
74
74
@@ -83,6 +83,34 @@ blockquote[data-callout] {
83
83
blockquote [data-callout = " error" ] {
84
84
background-color : red ;
85
85
}
86
+
87
+ [data-expanded = " false" ] .callout-content {
88
+ max-height : 0 ;
89
+ overflow : hidden ;
90
+ transition : max-height 0.2s ease-out ;
91
+ }
92
+
93
+ [data-expanded = " true" ] .callout-content {
94
+ max-height : 100px ; /* or whatever height needed */
95
+ }
96
+
97
+ [data-expandable = " true" ] .callout-title {
98
+ cursor : pointer ;
99
+ }
100
+ ```
101
+
102
+ ``` js
103
+ const callout = document .querySelector (' .callout-error' );
104
+
105
+ callout .addEventListener (' click' , () => {
106
+ if (callout .getAttribute (' data-expandable' ) === ' true' ) {
107
+ if (callout .getAttribute (' data-expanded' ) === ' false' ) {
108
+ callout .setAttribute (' data-expanded' , ' true' );
109
+ } else {
110
+ callout .setAttribute (' data-expanded' , ' false' );
111
+ }
112
+ }
113
+ });
86
114
```
87
115
88
116
### Configuration
@@ -133,6 +161,8 @@ export interface Config {
133
161
iconTagName: string ;
134
162
// the custom class name to be added to the title icon element
135
163
iconClass: string ;
164
+ // the custom class name to be added to the content element
165
+ contentClass: string ;
136
166
// predefined callouts, an object with callout's name as key, its SVG icon as value
137
167
// see https://help.obsidian.md/Editing+and+formatting/Callouts#Supported+types
138
168
// you can customize it by overriding the same callout's icon or passing new callout with customized name and icon
@@ -148,6 +178,7 @@ const defaultConfig: Config = {
148
178
titleTextTransform : (title : string ) => title .trim (),
149
179
iconTagName: " div" ,
150
180
iconClass: " callout-title-icon" ,
181
+ contentClass: " callout-content" ,
151
182
callouts: {
152
183
note: pencilIcon ,
153
184
abstract: clipboardListIcon ,
0 commit comments