File tree Expand file tree Collapse file tree 2 files changed +18
-12
lines changed
Expand file tree Collapse file tree 2 files changed +18
-12
lines changed Original file line number Diff line number Diff line change @@ -98,26 +98,31 @@ export function preprocessReadme(opts) {
9898 if ( id === "table-of-contents" ) return ;
9999
100100 const text = node . children [ 0 ] . raw ;
101- if ( prev === "h3" ) {
102- headings . push ( `</ul><li><a href="#${ id } ">${ text } </a></li>` ) ;
103- } else {
104- headings . push ( `<li><a href="#${ id } ">${ text } </a></li>` ) ;
105- }
106101
107- prev = "h2" ;
102+ if ( text !== undefined ) {
103+ if ( prev === "h3" ) {
104+ headings . push ( `</ul><li><a href="#${ id } ">${ text } </a></li>` ) ;
105+ } else {
106+ headings . push ( `<li><a href="#${ id } ">${ text } </a></li>` ) ;
107+ }
108+
109+ prev = "h2" ;
110+ }
108111 }
109112
110113 if ( node . type === "Element" && node . name === "h3" ) {
111114 const id = node . attributes . find ( ( attr ) => attr . name === "id" ) . value [ 0 ] . raw ;
112115 const text = node . children [ 0 ] . raw ;
113116
114- if ( prev === "h2" ) {
115- headings . push ( `<ul><li><a href="#${ id } ">${ text } </a></li>` ) ;
116- } else {
117- headings . push ( `<li><a href="#${ id } ">${ text } </a></li>` ) ;
118- }
117+ if ( text !== undefined ) {
118+ if ( prev === "h2" ) {
119+ headings . push ( `<ul><li><a href="#${ id } ">${ text } </a></li>` ) ;
120+ } else {
121+ headings . push ( `<li><a href="#${ id } ">${ text } </a></li>` ) ;
122+ }
119123
120- prev = "h3" ;
124+ prev = "h3" ;
125+ }
121126 }
122127
123128 if ( node . type === "Attribute" && node . name === "data-svelte" ) {
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ Check out my cool component library.
4848localStorage .getItem (" custom-theme-key" );
4949```
5050
51+ ## [ rollup.config.js] ( rollup.config.js )
5152
5253[ package.json] ( package.json )
5354
You can’t perform that action at this time.
0 commit comments