Skip to content

Commit

Permalink
fix(readmes): lowercase anchor links to prevent links breaking (#3062)
Browse files Browse the repository at this point in the history
* fix(readmes): lowercase anchor links to prevent links breaking

* fix(datatable): update prop comments to remove problematic syntax

* fix(datatable): regen readmes

* fix(datatable): update readme generator test
  • Loading branch information
tylermorrisford authored Feb 18, 2025
1 parent 7e99464 commit 0e8274e
Show file tree
Hide file tree
Showing 57 changed files with 211 additions and 239 deletions.
17 changes: 13 additions & 4 deletions generators/readme/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,10 @@ const parsePropTypesToMarkdown = (
propTypeNode = [
inlineCode('Object'),
html('<br/>'),
link(`#signature-${propName}`, 'See signature.'),
link(
`#signature-${propName.toLowerCase()}`,
'See signature.'
),
];
signatures.push(
...[
Expand All @@ -387,7 +390,10 @@ const parsePropTypesToMarkdown = (
propTypeNode = [
inlineCode('Function'),
html('<br/>'),
link(`#signature-${propName}`, 'See signature.'),
link(
`#signature-${propName.toLowerCase()}`,
'See signature.'
),
];
signatures.push(
...[
Expand Down Expand Up @@ -416,7 +422,7 @@ const parsePropTypesToMarkdown = (
propTypeNode = [
inlineCode(`Array: ${propInfoType.raw.replace('\n', '')}`),
html('<br/>'),
link(`#signature-${propName}`, 'See signature.'),
link(`#signature-${propName.toLowerCase()}`, 'See signature.'),
];
signatures.push(
...[
Expand Down Expand Up @@ -470,7 +476,10 @@ const parsePropTypesToMarkdown = (
...(possibleSignatures.length > 0
? [
html('<br/>'),
link(`#signature-${propName}`, 'See signature.'),
link(
`#signature-${propName.toLowerCase()}`,
'See signature.'
),
]
: []),
];
Expand Down
2 changes: 1 addition & 1 deletion generators/readme/test/generate-readme.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ describe('generate README (for TS file)', () => {
| - | - | :-: | - | - |
| \`name\` | \`string\` | ✅ | | The name of a Justice League member. |
| \`identity\` | \`Object\`<br/>[See signature.](#signature-identity) | ✅ | | The real identity of this Justice League member, if known. |
| \`onClick\` | \`Function\`<br/>[See signature.](#signature-onClick) | | | A callback function, called when the component is clicked. |
| \`onClick\` | \`Function\`<br/>[See signature.](#signature-onclick) | | | A callback function, called when the component is clicked. |
| \`abilities\` | \`Array: Ability[]\`<br/>[See signature.](#signature-abilities) | ✅ | | List the abilities of this Justice League member. |
| \`aliases\` | \`Array: string[]\` | ✅ | | List the aliases of this Justice League member. |
| \`movies\` | \`union\`<br/>Possible values:<br/>\`string , Movie\`<br/>[See signature.](#signature-movies) | ✅ | | The list of movies where this Justice League member appears in.&#xA;It can either be just the name of the movie or a more detailed&#xA;information about the movie. |
Expand Down
2 changes: 1 addition & 1 deletion packages/components/buttons/accessible-button/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default Example;
| `isToggled` | `boolean` | | `false` | If `true`, indicates that this element is in a toggled state.&#xA;<br/>&#xA;This prop is only used if `isToggleButton` is `true`. |
| `isDisabled` | `boolean` | | | If `true`, indicates that the element is in a disabled state. |
| `className` | `string` | | | Allow to override the styles by passing a `className` prop.&#xA;<br/>&#xA;Custom styles can also be passed using the [`css` prop from emotion](https://emotion.sh/docs/css-prop#style-precedence). |
| `onClick` | `Function`<br/>[See signature.](#signature-onClick) | | | Event handler when the button is clicked, or the user presses `ENTER` or `SPACE`. |
| `onClick` | `Function`<br/>[See signature.](#signature-onclick) | | | Event handler when the button is clicked, or the user presses `ENTER` or `SPACE`. |
| `buttonAttributes` | `Record` | | `{}` | Any HTML attributes to be forwarded to the HTML element. |

## Signatures
Expand Down
2 changes: 1 addition & 1 deletion packages/components/buttons/flat-button/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default Example;
| `tone` | `union`<br/>Possible values:<br/>`'primary' , 'secondary' , 'inverted' , 'critical'` | | `'primary'` | Indicates the color scheme of the button. |
| `type` | `union`<br/>Possible values:<br/>`'submit' , 'reset' , 'button'` | | `'button'` | Used as the HTML `type` attribute. |
| `label` | `string` || | Should describe what the button is for. |
| `onClick` | `Function`<br/>[See signature.](#signature-onClick) | | | Handler when the button is clicked. |
| `onClick` | `Function`<br/>[See signature.](#signature-onclick) | | | Handler when the button is clicked. |
| `icon` | `ReactElement` | | | The icon of the button. |
| `iconPosition` | `union`<br/>Possible values:<br/>`'left' , 'right'` | | `'left'` | The position of the icon. |
| `isDisabled` | `boolean` | | `false` | Determines if the button is disabled.&#xA;<br />&#xA;Note that this influences the `tone` and `onClick` will not be triggered in this state. |
Expand Down
2 changes: 1 addition & 1 deletion packages/components/buttons/icon-button/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default Example;
| `isToggleButton` | `boolean` | | `false` | If this is active, it means the button will persist in an "active" state when toggled (see `isToggled`), and back to normal state when untoggled. |
| `isToggled` | `boolean` | | | Tells when the button should present a toggled state. It does not have any effect when `isToggleButton` is `false`. |
| `isDisabled` | `boolean` | | | Tells when the button should present a disabled state. |
| `onClick` | `Function`<br/>[See signature.](#signature-onClick) | | | Handler when the button is clicked |
| `onClick` | `Function`<br/>[See signature.](#signature-onclick) | | | Handler when the button is clicked |
| `shape` | `union`<br/>Possible values:<br/>`'round' , 'square'` | | `'round'` | @deprecated This prop is only used in the old theme. For the new theme this prop will not be taken into account and `square` is used by default |
| `theme` | `union`<br/>Possible values:<br/>`'default' , 'primary' , 'info'` | | `'default'` | The component may have a theme only if `isToggleButton` is `true` |
| `size` | `union`<br/>Possible values:<br/>`TLegacySizes , TSizes` | | `'40'` | Indicates the size of the icon. Available sizes are '10', '20', '30', '40'. |
Expand Down
2 changes: 1 addition & 1 deletion packages/components/buttons/primary-button/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default Example;
| `isToggleButton` | `boolean` | | `false` | If this is active, it means the button will persist in an "active" state when toggled (see `isToggled`), and back to normal state when untoggled |
| `isToggled` | `boolean` | | | Tells when the button should present a toggled state. It does not have any effect when `isToggleButton` is `false`. |
| `isDisabled` | `boolean` | | | Tells when the button should present a disabled state. |
| `onClick` | `Function`<br/>[See signature.](#signature-onClick) | | | Handler when the button is clicked.&#xA;<br />&#xA;Required when `as` is `undefined` |
| `onClick` | `Function`<br/>[See signature.](#signature-onclick) | | | Handler when the button is clicked.&#xA;<br />&#xA;Required when `as` is `undefined` |
| `size` | `union`<br/>Possible values:<br/>`TLegacySizes , TSizes` | | `'20'` | Sets the size of the button.&#xA;<br />&#xA;`small`, `medium`, and `big` are deprecated. Use `10`, `20`, instead. |
| `tone` | `union`<br/>Possible values:<br/>`'urgent' , 'primary' , 'critical'` | | `'primary'` | Indicates the color scheme of the button. |

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default Example;
| `label` | `string` || | Should describe what the button does, for accessibility purposes (screen-reader users) |
| `isDisabled` | `boolean` | | `false` | Tells when the button should present a disabled state. |
| `size` | `union`<br/>Possible values:<br/>`TLegacySizes , TSizes` | | `'40'` | Indicates the size of the icon. Available sizes are '10', '20', '30', '40'. |
| `onClick` | `Function`<br/>[See signature.](#signature-onClick) | | | Handler when the button is clicked. |
| `onClick` | `Function`<br/>[See signature.](#signature-onclick) | | | Handler when the button is clicked. |

## Signatures

Expand Down
2 changes: 1 addition & 1 deletion packages/components/card/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default Example;
| `theme` | `union`<br/>Possible values:<br/>`'light' , 'dark'` | | `'light'` | Determines the background color of the card. |
| `className` | `string` | | | Pass a custom CSS class, useful to override the styles.&#xA;<br>&#xA;NOTE: This is not recommended and should only be used for building new components&#xA;that require special style adjustments. |
| `children` | `ReactNode` | | | |
| `onClick` | `Function`<br/>[See signature.](#signature-onClick) | | | The callback function to be executed when the Card component is clicked. Prefer this for managing side effects rather than navigation. |
| `onClick` | `Function`<br/>[See signature.](#signature-onclick) | | | The callback function to be executed when the Card component is clicked. Prefer this for managing side effects rather than navigation. |
| `to` | `union`<br/>Possible values:<br/>`string , LocationDescriptor` | | | The URL that the Card should point to. If provided, the Card will be rendered as an anchor element. |
| `isExternalLink` | `boolean` | | | A flag to indicate if the Card points to an external source. |
| `isDisabled` | `boolean` | | | Indicates that a clickable Card should not allow clicks. This allows consumers to temporarily disable a clickable Card. |
Expand Down
Loading

0 comments on commit 0e8274e

Please sign in to comment.