Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tabs: Auto-generate README #68209

Open
wants to merge 11 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions bin/api-docs/gen-components-docs/markdown/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@ import json2md from 'json2md';
*/
import { generateMarkdownPropsJson } from './props.mjs';

function normalizeTrailingNewline( str ) {
mirka marked this conversation as resolved.
Show resolved Hide resolved
return str?.length ? str.replace( /\n*$/, '\n' ) : undefined;
}

export function generateMarkdownDocs( { typeDocs, subcomponentTypeDocs } ) {
const mainDocsJson = [
{ h1: typeDocs.displayName },
'<!-- This file is generated automatically and cannot be edited directly. Make edits via TypeScript types and TSDocs. -->',
{
p: `<p class="callout callout-info">See the <a href="https://wordpress.github.io/gutenberg/?path=/docs/components-${ typeDocs.displayName.toLowerCase() }--docs">WordPress Storybook</a> for more detailed, interactive documentation.</p>`,
},
typeDocs.description,
normalizeTrailingNewline( typeDocs.description ),
...generateMarkdownPropsJson( typeDocs.props ),
];

Expand All @@ -26,7 +30,7 @@ export function generateMarkdownDocs( { typeDocs, subcomponentTypeDocs } ) {
{
h3: subcomponentTypeDoc.displayName,
},
subcomponentTypeDoc.description,
normalizeTrailingNewline( subcomponentTypeDoc.description ),
...generateMarkdownPropsJson( subcomponentTypeDoc.props, {
headingLevel: 4,
} ),
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/alignment-matrix-control/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const Example = () => {
);
};
```

## Props

### `defaultValue`
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/angle-picker-control/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ function Example() {
);
}
```

## Props

### `as`
Expand Down
2 changes: 2 additions & 0 deletions packages/components/src/base-control/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const MyCustomTextareaControl = ({ children, ...baseProps }) => (
);
);
```

## Props

### `__nextHasNoMarginBottom`
Expand Down Expand Up @@ -113,6 +114,7 @@ const MyBaseControl = () => (
</BaseControl>
);
```

#### Props

##### `as`
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/box-control/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ function Example() {
);
};
```

## Props

### `__next40pxDefaultSize`
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/button/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const Mybutton = () => (
</Button>
);
```

## Props

### `__next40pxDefaultSize`
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/form-file-upload/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const MyFormFileUpload = () => (
</FormFileUpload>
);
```

## Props

### `__next40pxDefaultSize`
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/gradient-picker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const MyGradientPicker = () => {
);
};
```

## Props

### `__experimentalIsRenderedInSidebar`
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/icon/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { wordpress } from '@wordpress/icons';

<Icon icon={ wordpress } />
```

## Props

### `icon`
Expand Down
Loading
Loading