Skip to content

Commit

Permalink
[docs] Don't escape prop descriptions for markdown table context (#26579
Browse files Browse the repository at this point in the history
)
  • Loading branch information
eps1lon authored Jun 7, 2021
1 parent 77e0035 commit fe22aa7
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 15 deletions.
8 changes: 2 additions & 6 deletions docs/scripts/buildApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ function resolveType(type: NonNullable<doctrine.Tag['type']>): string {
}

if (type.type === 'UnionType') {
return type.elements.map((t) => resolveType(t)).join(' \\| ');
return type.elements.map((t) => resolveType(t)).join(' | ');
}

if ('name' in type) {
Expand Down Expand Up @@ -859,11 +859,7 @@ async function buildDocs(options: {
description +=
' See the <a href="/system/basics/#the-sx-prop">`sx` page</a> for more details.';
}

componentApi.propDescriptions = {
...componentApi.propDescriptions,
[propName]: description && description.replace(/\n@default.*$/, ''),
};
componentApi.propDescriptions[propName] = description.replace(/\n@default.*$/, '');

// Only keep `default` for bool props if it isn't 'false'.
let defaultValue: string | undefined;
Expand Down
2 changes: 1 addition & 1 deletion docs/translations/api-docs/autocomplete/autocomplete.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"loadingText": "Text to display when in a loading state.<br>For localization purposes, you can use the provided <a href=\"/guides/localization/\">translations</a>.",
"multiple": "If <code>true</code>, <code>value</code> must be an array and the menu will support multiple selections.",
"noOptionsText": "Text to display when there are no options.<br>For localization purposes, you can use the provided <a href=\"/guides/localization/\">translations</a>.",
"onChange": "Callback fired when the value changes.<br><br><strong>Signature:</strong><br><code>function(event: object, value: T \\| T[], reason: string, details?: string) =&gt; void</code><br><em>event:</em> The event source of the callback.<br><em>value:</em> The new value of the component.<br><em>reason:</em> One of &quot;createOption&quot;, &quot;selectOption&quot;, &quot;removeOption&quot;, &quot;blur&quot; or &quot;clear&quot;.",
"onChange": "Callback fired when the value changes.<br><br><strong>Signature:</strong><br><code>function(event: object, value: T | T[], reason: string, details?: string) =&gt; void</code><br><em>event:</em> The event source of the callback.<br><em>value:</em> The new value of the component.<br><em>reason:</em> One of &quot;createOption&quot;, &quot;selectOption&quot;, &quot;removeOption&quot;, &quot;blur&quot; or &quot;clear&quot;.",
"onClose": "Callback fired when the popup requests to be closed. Use in controlled mode (see open).<br><br><strong>Signature:</strong><br><code>function(event: object, reason: string) =&gt; void</code><br><em>event:</em> The event source of the callback.<br><em>reason:</em> Can be: <code>&quot;toggleInput&quot;</code>, <code>&quot;escape&quot;</code>, <code>&quot;selectOption&quot;</code>, <code>&quot;removeOption&quot;</code>, <code>&quot;blur&quot;</code>.",
"onHighlightChange": "Callback fired when the highlight option changes.<br><br><strong>Signature:</strong><br><code>function(event: object, option: T, reason: string) =&gt; void</code><br><em>event:</em> The event source of the callback.<br><em>option:</em> The highlighted option.<br><em>reason:</em> Can be: <code>&quot;keyboard&quot;</code>, <code>&quot;auto&quot;</code>, <code>&quot;mouse&quot;</code>.",
"onInputChange": "Callback fired when the input value changes.<br><br><strong>Signature:</strong><br><code>function(event: object, value: string, reason: string) =&gt; void</code><br><em>event:</em> The event source of the callback.<br><em>value:</em> The new value of the text input.<br><em>reason:</em> Can be: <code>&quot;input&quot;</code> (user input), <code>&quot;reset&quot;</code> (programmatic change), <code>&quot;clear&quot;</code>.",
Expand Down
2 changes: 1 addition & 1 deletion docs/translations/api-docs/rating/rating.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"IconContainerComponent": "The component containing the icon.",
"max": "Maximum rating.",
"name": "The name attribute of the radio <code>input</code> elements. This input <code>name</code> should be unique within the page. Being unique within a form is insufficient since the <code>name</code> is used to generated IDs.",
"onChange": "Callback fired when the value changes.<br><br><strong>Signature:</strong><br><code>function(event: object, value: number \\| null) =&gt; void</code><br><em>event:</em> The event source of the callback.<br><em>value:</em> The new value.",
"onChange": "Callback fired when the value changes.<br><br><strong>Signature:</strong><br><code>function(event: object, value: number | null) =&gt; void</code><br><em>event:</em> The event source of the callback.<br><em>value:</em> The new value.",
"onChangeActive": "Callback function that is fired when the hover state changes.<br><br><strong>Signature:</strong><br><code>function(event: object, value: number) =&gt; void</code><br><em>event:</em> The event source of the callback.<br><em>value:</em> The new value.",
"precision": "The minimum increment value change allowed.",
"readOnly": "Removes all hover effects and pointer events.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"max": "The maximum allowed value of the slider. Should not be equal to min.",
"min": "The minimum allowed value of the slider. Should not be equal to max.",
"name": "Name attribute of the hidden <code>input</code> element.",
"onChange": "Callback function that is fired when the slider&#39;s value changed.<br><br><strong>Signature:</strong><br><code>function(event: object, value: number \\| number[], activeThumb: number) =&gt; void</code><br><em>event:</em> The event source of the callback. You can pull out the new value by accessing <code>event.target.value</code> (any). <strong>Warning</strong>: This is a generic event not a change event.<br><em>value:</em> The new value.<br><em>activeThumb:</em> Index of the currently moved thumb.",
"onChangeCommitted": "Callback function that is fired when the <code>mouseup</code> is triggered.<br><br><strong>Signature:</strong><br><code>function(event: object, value: number \\| number[]) =&gt; void</code><br><em>event:</em> The event source of the callback. <strong>Warning</strong>: This is a generic event not a change event.<br><em>value:</em> The new value.",
"onChange": "Callback function that is fired when the slider&#39;s value changed.<br><br><strong>Signature:</strong><br><code>function(event: object, value: number | number[], activeThumb: number) =&gt; void</code><br><em>event:</em> The event source of the callback. You can pull out the new value by accessing <code>event.target.value</code> (any). <strong>Warning</strong>: This is a generic event not a change event.<br><em>value:</em> The new value.<br><em>activeThumb:</em> Index of the currently moved thumb.",
"onChangeCommitted": "Callback function that is fired when the <code>mouseup</code> is triggered.<br><br><strong>Signature:</strong><br><code>function(event: object, value: number | number[]) =&gt; void</code><br><em>event:</em> The event source of the callback. <strong>Warning</strong>: This is a generic event not a change event.<br><em>value:</em> The new value.",
"orientation": "The component orientation.",
"scale": "A transformation function, to change the scale of the slider.",
"step": "The granularity with which the slider can step through values. (A &quot;discrete&quot; slider.) The <code>min</code> prop serves as the origin for the valid values. We recommend (max - min) to be evenly divisible by the step.<br>When step is <code>null</code>, the thumb can only be slid onto marks provided with the <code>marks</code> prop.",
Expand Down
4 changes: 2 additions & 2 deletions docs/translations/api-docs/slider/slider.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"max": "The maximum allowed value of the slider. Should not be equal to min.",
"min": "The minimum allowed value of the slider. Should not be equal to max.",
"name": "Name attribute of the hidden <code>input</code> element.",
"onChange": "Callback function that is fired when the slider&#39;s value changed.<br><br><strong>Signature:</strong><br><code>function(event: object, value: number \\| number[], activeThumb: number) =&gt; void</code><br><em>event:</em> The event source of the callback. You can pull out the new value by accessing <code>event.target.value</code> (any). <strong>Warning</strong>: This is a generic event not a change event.<br><em>value:</em> The new value.<br><em>activeThumb:</em> Index of the currently moved thumb.",
"onChangeCommitted": "Callback function that is fired when the <code>mouseup</code> is triggered.<br><br><strong>Signature:</strong><br><code>function(event: object, value: number \\| number[]) =&gt; void</code><br><em>event:</em> The event source of the callback. <strong>Warning</strong>: This is a generic event not a change event.<br><em>value:</em> The new value.",
"onChange": "Callback function that is fired when the slider&#39;s value changed.<br><br><strong>Signature:</strong><br><code>function(event: object, value: number | number[], activeThumb: number) =&gt; void</code><br><em>event:</em> The event source of the callback. You can pull out the new value by accessing <code>event.target.value</code> (any). <strong>Warning</strong>: This is a generic event not a change event.<br><em>value:</em> The new value.<br><em>activeThumb:</em> Index of the currently moved thumb.",
"onChangeCommitted": "Callback function that is fired when the <code>mouseup</code> is triggered.<br><br><strong>Signature:</strong><br><code>function(event: object, value: number | number[]) =&gt; void</code><br><em>event:</em> The event source of the callback. <strong>Warning</strong>: This is a generic event not a change event.<br><em>value:</em> The new value.",
"orientation": "The component orientation.",
"scale": "A transformation function, to change the scale of the slider.",
"step": "The granularity with which the slider can step through values. (A &quot;discrete&quot; slider.) The <code>min</code> prop serves as the origin for the valid values. We recommend (max - min) to be evenly divisible by the step.<br>When step is <code>null</code>, the thumb can only be slid onto marks provided with the <code>marks</code> prop.",
Expand Down
2 changes: 1 addition & 1 deletion docs/translations/api-docs/tree-view/tree-view.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"id": "This prop is used to help implement the accessibility logic. If you don&#39;t provide this prop. It falls back to a randomly generated id.",
"multiSelect": "If true <code>ctrl</code> and <code>shift</code> will trigger multiselect.",
"onNodeFocus": "Callback fired when tree items are focused.<br><br><strong>Signature:</strong><br><code>function(event: object, value: string) =&gt; void</code><br><em>event:</em> The event source of the callback <strong>Warning</strong>: This is a generic event not a focus event.<br><em>value:</em> of the focused node.",
"onNodeSelect": "Callback fired when tree items are selected/unselected.<br><br><strong>Signature:</strong><br><code>function(event: object, value: array \\| string) =&gt; void</code><br><em>event:</em> The event source of the callback<br><em>value:</em> of the selected nodes. When <code>multiSelect</code> is true this is an array of strings; when false (default) a string.",
"onNodeSelect": "Callback fired when tree items are selected/unselected.<br><br><strong>Signature:</strong><br><code>function(event: object, value: array | string) =&gt; void</code><br><em>event:</em> The event source of the callback<br><em>value:</em> of the selected nodes. When <code>multiSelect</code> is true this is an array of strings; when false (default) a string.",
"onNodeToggle": "Callback fired when tree items are expanded/collapsed.<br><br><strong>Signature:</strong><br><code>function(event: object, nodeIds: array) =&gt; void</code><br><em>event:</em> The event source of the callback.<br><em>nodeIds:</em> The ids of the expanded nodes.",
"selected": "Selected node ids. (Controlled) When <code>multiSelect</code> is true this takes an array of strings; when false (default) a string.",
"sx": "The system prop that allows defining system overrides as well as additional CSS styles. See the <a href=\"/system/basics/#the-sx-prop\">`sx` page</a> for more details."
Expand Down
6 changes: 4 additions & 2 deletions packages/material-ui-system/src/Box/Box.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,9 @@ export interface BoxTypeMap<P = {}, D extends React.ElementType = 'div'> {

declare const Box: OverridableComponent<BoxTypeMap>;

export type BoxProps<D extends React.ElementType = BoxTypeMap['defaultComponent'], P = {}> =
OverrideProps<BoxTypeMap<P, D>, D>;
export type BoxProps<
D extends React.ElementType = BoxTypeMap['defaultComponent'],
P = {},
> = OverrideProps<BoxTypeMap<P, D>, D>;

export default Box;

0 comments on commit fe22aa7

Please sign in to comment.