You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+20-18Lines changed: 20 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -13,11 +13,13 @@ guidelines in order to be analyzable (see below for more info).
13
13
14
14
## Install
15
15
16
-
Install the module using `yarn` or `npm`:
16
+
Install the module with yarn or npm:
17
17
18
-
```sh
18
+
```
19
19
yarn add react-docgen --dev
20
-
# or
20
+
```
21
+
22
+
```
21
23
npm install --save-dev react-docgen
22
24
```
23
25
@@ -28,7 +30,7 @@ a single file, multiple files or an input stream. We are trying to make the
28
30
executable as versatile as possible so that it can be integrated into many
29
31
workflows.
30
32
31
-
```console
33
+
```
32
34
Usage: react-docgen [path]... [options]
33
35
34
36
path A component file or directory. If no path is provided it reads from stdin.
@@ -64,8 +66,8 @@ it will fallback to a default configuration, enabling all [syntax extension](htt
64
66
The tool can be used programmatically to extract component information and customize the extraction process:
65
67
66
68
```js
67
-
constreactDocs=require('react-docgen');
68
-
constcomponentInfo=reactDocs.parse(src);
69
+
var reactDocs =require('react-docgen');
70
+
var componentInfo =reactDocs.parse(src);
69
71
```
70
72
71
73
As with the CLI, this will look for the exported component created through `React.createClass` or a class definition in the provided source. The whole process of analyzing the source code is separated into two parts:
@@ -132,7 +134,7 @@ supported options head over to the [babel website](https://babeljs.io/docs/en/ba
132
134
The resolver's task is to extract those parts from the source code which the handlers can analyze. For example, the `findExportedComponentDefinition` resolver inspects the AST to find
133
135
134
136
```js
135
-
constComponent=React.createClass(<def>);
137
+
var Component =React.createClass(<def>);
136
138
module.exports= Component;
137
139
138
140
// or
@@ -155,7 +157,7 @@ Handlers do the actual work and extract the desired information from the result
155
157
156
158
For example, while the `propTypesHandler` expects the prop types definition to be an ObjectExpression and be available as `propTypes` in the component definition, most of the work is actually performed by the `getPropType` utility function.
157
159
158
-
> There are some community created handlers available. Have a look at the wiki for a list: <https://github.com/reactjs/react-docgen/wiki>
160
+
> There are some community created handlers available. Have a look at the wiki for a list: https://github.com/reactjs/react-docgen/wiki
159
161
160
162
## Guidelines for default resolvers and handlers
161
163
@@ -368,18 +370,18 @@ we are getting this output:
368
370
369
371
Here is a list of all the available types and its result structure.
0 commit comments