@@ -8,8 +8,7 @@ ${attributes
88 . map (
99 attr => `| ${ code ( attr . name ) } | ${ code ( attr . type ) } | ${ attr . description } |`
1010 )
11- . join ( "\n" ) }
12- ` ;
11+ . join ( "\n" ) } `;
1312
1413const transformProperties = ( properties : any [ ] ) => `
1514## Properties
@@ -23,8 +22,7 @@ ${properties
2322 prop . default
2423 } | ${ prop . description } |`
2524 )
26- . join ( "\n" ) }
27- ` ;
25+ . join ( "\n" ) } `;
2826
2927const transformEvents = ( events : any [ ] ) => `
3028## Events
@@ -33,16 +31,16 @@ const transformEvents = (events: any[]) => `
3331| ----- | ----------- |
3432${ events
3533 . map ( event => `| ${ code ( event . name ) } | ${ code ( event . description ) } |` )
36- . join ( "\n" ) }
37- ` ;
34+ . join ( "\n" ) } `;
3835
3936const transformSlots = ( slots : any [ ] ) => `
4037## Slots
4138
4239| Name | Description |
4340| ---- | ----------- |
44- ${ slots . map ( slot => `| ${ code ( slot . name ) } | ${ slot . description } |` ) . join ( "\n" ) }
45- ` ;
41+ ${ slots
42+ . map ( slot => `| ${ code ( slot . name ) } | ${ slot . description } |` )
43+ . join ( "\n" ) } `;
4644
4745const transformCSSParts = ( shadowParts : any [ ] ) => `
4846## CSS Shadow Parts
@@ -51,43 +49,52 @@ const transformCSSParts = (shadowParts: any[]) => `
5149| ---- | ----------- |
5250${ shadowParts
5351 . map ( part => `| ${ code ( part . name ) } | ${ part . description } |` )
54- . join ( "\n" ) }
55- ` ;
52+ . join ( "\n" ) } `;
5653
5754const transformCSSProperties = ( cssProperties : any [ ] ) => `
5855## CSS Custom Properties
5956
60- | Property | Description |
61- | -------- | ----------- |
57+ | Property | Syntax | Description |
58+ | -------- | ------ | ------ ----- |
6259${ cssProperties
63- . map ( cssProp => `| ${ code ( cssProp . name ) } | ${ cssProp . description } |` )
64- . join ( "\n" ) }
65- ` ;
60+ . map (
61+ cssProp =>
62+ `| ${ code ( cssProp . name ) } | ${ code ( cssProp . syntax ) } | ${
63+ cssProp . description
64+ } |`
65+ )
66+ . join ( "\n" ) } `;
6667
6768export default customElements => {
6869 let markdownParts = [ ] ;
6970 for ( const customElement of customElements . tags ) {
7071 if ( ! customElement ) return undefined ;
71- markdownParts . push ( `# ${ customElement . name } ` ) ;
72- markdownParts . push ( customElement . description ) ;
73- customElement . attributes &&
74- customElement . attributes . length > 0 &&
75- markdownParts . push ( transformAttributes ( customElement . attributes ) ) ;
76- customElement . properties &&
77- customElement . properties . length > 0 &&
78- markdownParts . push ( transformProperties ( customElement . properties ) ) ;
79- customElement . events &&
80- customElement . events . length > 0 &&
81- markdownParts . push ( transformEvents ( customElement . events ) ) ;
82- customElement . slots &&
83- customElement . slots . length > 0 &&
84- markdownParts . push ( transformSlots ( customElement . slots ) ) ;
85- customElement . cssParts &&
86- customElement . cssParts . length > 0 &&
87- markdownParts . push ( transformCSSParts ( customElement . cssParts ) ) ;
88- customElement . cssProperties &&
89- customElement . cssProperties . length > 0 &&
90- markdownParts . push ( transformCSSProperties ( customElement . cssProperties ) ) ;
72+ const {
73+ name,
74+ description,
75+ attributes,
76+ properties,
77+ events,
78+ slots,
79+ cssParts,
80+ cssProperties
81+ } = customElement ;
82+ markdownParts . push ( `# ${ name } ` ) ;
83+ markdownParts . push ( description ) ;
84+ attributes &&
85+ attributes . length > 0 &&
86+ markdownParts . push ( transformAttributes ( attributes ) ) ;
87+ properties &&
88+ properties . length > 0 &&
89+ markdownParts . push ( transformProperties ( properties ) ) ;
90+ events && events . length > 0 && markdownParts . push ( transformEvents ( events ) ) ;
91+ slots && slots . length > 0 && markdownParts . push ( transformSlots ( slots ) ) ;
92+ cssParts &&
93+ cssParts . length > 0 &&
94+ markdownParts . push ( transformCSSParts ( cssParts ) ) ;
95+ cssProperties &&
96+ cssProperties . length > 0 &&
97+ markdownParts . push ( transformCSSProperties ( cssProperties ) ) ;
9198 }
92- return markdownParts . join ( "\n" ) ;
99+ return markdownParts . join ( "\n\n " ) ;
93100} ;
0 commit comments