File tree 1 file changed +13
-1
lines changed
plugins/docusaurus-plugin-ionic-component-api
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -121,6 +121,18 @@ function formatMultiline(str) {
121
121
return str . split ( '\n\n' ) . join ( '<br /><br />' ) . split ( '\n' ) . join ( ' ' ) ;
122
122
}
123
123
124
+ function formatType ( attr , type ) {
125
+ if ( attr === 'color' ) {
126
+ /**
127
+ * The `color` attribute has an additional type that we don't want to display.
128
+ * The union type is used to allow intellisense to recommend the color names,
129
+ * while still accepting any string value.
130
+ */
131
+ type = type . replace ( 'string & Record<never, never>' , 'string' ) ;
132
+ }
133
+ return type . replace ( / \| / g, '\uff5c' ) ;
134
+ }
135
+
124
136
function renderProperties ( { props : properties } ) {
125
137
if ( properties . length === 0 ) {
126
138
return 'No properties available for this component.' ;
@@ -141,7 +153,7 @@ ${properties
141
153
| --- | --- |
142
154
| **Description** | ${ formatMultiline ( docs ) } |
143
155
| **Attribute** | \`${ prop . attr } \` |
144
- | **Type** | \`${ prop . type . replace ( / \| / g , '\uff5c' ) } \` |
156
+ | **Type** | \`${ formatType ( prop . attr , prop . type ) } \` |
145
157
| **Default** | \`${ prop . default } \` |
146
158
147
159
` ;
You can’t perform that action at this time.
0 commit comments