File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
plugins/docusaurus-plugin-ionic-component-api Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -121,6 +121,18 @@ function formatMultiline(str) {
121121 return str . split ( '\n\n' ) . join ( '<br /><br />' ) . split ( '\n' ) . join ( ' ' ) ;
122122}
123123
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+
124136function renderProperties ( { props : properties } ) {
125137 if ( properties . length === 0 ) {
126138 return 'No properties available for this component.' ;
@@ -141,7 +153,7 @@ ${properties
141153| --- | --- |
142154| **Description** | ${ formatMultiline ( docs ) } |
143155| **Attribute** | \`${ prop . attr } \` |
144- | **Type** | \`${ prop . type . replace ( / \| / g , '\uff5c' ) } \` |
156+ | **Type** | \`${ formatType ( prop . attr , prop . type ) } \` |
145157| **Default** | \`${ prop . default } \` |
146158
147159` ;
You can’t perform that action at this time.
0 commit comments