File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11// Jest Snapshot v1, https://goo.gl/fbAQLP
22
33exports [` spoilers should not show spoiler if duped start token 1` ] = `
4- "<details ></details >
5- <details ></details >
6- <details ></details >
7- <details ></details >
8- <details ></details >
9- <details ></details >
4+ "<details ><summary >Open spoiler</ summary >< /details >
5+ <details ><summary >Open spoiler</ summary >< /details >
6+ <details ><summary >Open spoiler</ summary >< /details >
7+ <details ><summary >Open spoiler</ summary >< /details >
8+ <details ><summary >Open spoiler</ summary >< /details >
9+ <details ><summary >Open spoiler</ summary >< /details >
1010<p >why isn't this working!?</p >
1111<p >there's no end!!!</p >
1212"
@@ -44,7 +44,7 @@ exports[`spoilers should show spoiler with custom summary 1`] = `
4444` ;
4545
4646exports [` spoilers should show spoiler with details class name 1` ] = `
47- "<details class =\\"hello hello-world\\"><p>peek-a-boo!</p></details>
47+ "<details class =\\"hello hello-world\\"><summary>Open spoiler</summary>< p>peek-a-boo!</p></details>
4848"
4949`;
5050
@@ -54,6 +54,6 @@ exports[`spoilers should show spoiler with summary class name 1`] = `
5454`;
5555
5656exports[`spoilers should show spoiler without custom summary 1`] = `
57- " <details><p>peek-a-boo!</p></details>
57+ " <details><summary>Open spoiler</summary>< p>peek-a-boo!</p></details>
5858"
5959`;
Original file line number Diff line number Diff line change @@ -71,32 +71,28 @@ export default function plugin(options = {}) {
7171 const start = eat . now ( )
7272 const add = eat ( block )
7373 const end = eat . now ( )
74- let children = [ ]
7574 let childrenBlockContent = this . tokenizeBlock ( blockContent , start )
7675
77- if ( summary !== '' ) {
78- children . push ( {
79- type : 'summary' ,
80- data : {
81- hName : 'summary' ,
82- hProperties : {
83- class : options . summaryClassName
84- }
85- } ,
86- children : [
87- {
88- type : 'text' ,
89- value : summary
90- }
91- ]
92- } )
93- }
94-
95- children = [ ...children , ...childrenBlockContent ]
96-
9776 return add ( {
9877 type : 'spoiler' ,
99- children : children ,
78+ children : [
79+ {
80+ type : 'summary' ,
81+ data : {
82+ hName : 'summary' ,
83+ hProperties : {
84+ class : options . summaryClassName
85+ }
86+ } ,
87+ children : [
88+ {
89+ type : 'text' ,
90+ value : summary !== '' ? summary : options . defaultSummary
91+ }
92+ ]
93+ } ,
94+ ...childrenBlockContent
95+ ] ,
10096 data : {
10197 hName : 'details' ,
10298 hProperties : {
You can’t perform that action at this time.
0 commit comments