File tree Expand file tree Collapse file tree 4 files changed +25
-18
lines changed Expand file tree Collapse file tree 4 files changed +25
-18
lines changed Original file line number Diff line number Diff line change 11{
22 "id" : " obsidian-admonition" ,
33 "name" : " Admonition" ,
4- "version" : " 0.2.2 " ,
4+ "version" : " 0.2.3 " ,
55 "minAppVersion" : " 0.11.0" ,
66 "description" : " Admonition block-styled content for Obsidian.md" ,
77 "author" : " Jeremy Valentine" ,
Original file line number Diff line number Diff line change 11{
22 "name" : " obsidian-admonition" ,
3- "version" : " 0.2.2 " ,
3+ "version" : " 0.2.3 " ,
44 "description" : " Admonition block-styled content for Obsidian.md" ,
55 "main" : " main.js" ,
66 "scripts" : {
Original file line number Diff line number Diff line change @@ -182,29 +182,36 @@ export default class ObsidianAdmonition extends Plugin {
182182 title : string ,
183183 collapse ?: string
184184 ) : HTMLElement {
185- let attrs ,
186- els : Array < keyof HTMLElementTagNameMap > = [ "div" , "div" ] ;
185+ let admonition ;
187186 if ( collapse ) {
188- els = [ "details" , "summary" ] ;
187+ let attrs ;
189188 if ( collapse === "open" ) {
190189 attrs = { open : "open" } ;
191190 } else {
192191 attrs = { } ;
193192 }
194- /* attrs = {
195- [collapse]: true
196- }; */
193+ admonition = createEl ( "details" , {
194+ cls : `admonition admonition-${ type } ` ,
195+ attr : attrs
196+ } ) ;
197+ admonition . createEl ( "summary" , {
198+ cls : `admonition-title ${
199+ ! title . trim ( ) . length ? "no-title" : ""
200+ } `,
201+ text : title
202+ } ) ;
203+ } else {
204+ admonition = createDiv ( {
205+ cls : `admonition admonition-${ type } `
206+ } ) ;
207+ admonition . createDiv ( {
208+ cls : `admonition-title ${
209+ ! title . trim ( ) . length ? "no-title" : ""
210+ } `,
211+ text : title
212+ } ) ;
197213 }
198214
199- let admonition = createEl ( els [ 0 ] , {
200- cls : `admonition admonition-${ type } ` ,
201- attr : attrs
202- } ) ;
203- admonition . createEl ( els [ 1 ] , {
204- cls : `admonition-title ${ ! title . trim ( ) . length ? "no-title" : "" } ` ,
205- text : title
206- } ) ;
207-
208215 return admonition ;
209216 }
210217 onunload ( ) {
Original file line number Diff line number Diff line change 11{
2- "0.2.2 " : " 0.11.0"
2+ "0.2.3 " : " 0.11.0"
33}
You can’t perform that action at this time.
0 commit comments