Skip to content

Parse react source file and generate html or markdown table

License

Notifications You must be signed in to change notification settings

ly-tools/react-prop-table

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-prop-table

Test coverage Build Status Dependency Status devDependency Status NPM version node License npm download

Parse react source file and generate html or markdown or cli table

Install

$ npm install --save react-prop-table
const Docer = require('react-doc-md');
Docer.html(source, config);
Docer.markdown(source, config);
Docer.cli(source, config);

Usage

ES5 Example

See ES5 source example

ES6 Example

See ES6 source example

Docer.html(source, config)

  • source:String => JSX source code
  • config:Object => configuration
    • config.tidy:Boolean => Tidy the result html or not
    • config.headers:Array(Object) => Headers config
      • header.name:String => key in data object
      • header.align:Enum('left'|'right'|'center') => text align of the column
      • header.title:String => title of the column
const Docer = require('react-prop-table');
Docer.html(source);

Result see HTML table

Docer.markdown(source, config)

  • source:String => JSX source code
  • config:Object => configuration
    • config.headers:Array(Object) => Headers config
      • header.name:String => key in data object
      • header.align:String => text align of the column
      • header.title:String => title of the column
const Docer = require('react-prop-table');
Docer.markdown(source);

Result see markdown table

Docer.cli(source, config)

  • source:String => JSX source code
  • config:Object => configuration
    • config.headers:Array(Object) => Headers config
      • header.name:String => key in data object
      • header.align:String => text align of the column
      • header.title:String => title of the column
      • header.width:Number => Width of the column
const Docer = require('react-prop-table');
Docer.cli(source);

Result see cli table

Test

$ npm run test
$ npm run test-cov
$ npm run test-travis

License

The MIT License (MIT)

Copyright (c) 2015 LingyuCoder

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Parse react source file and generate html or markdown table

Resources

License

Stars

Watchers

Forks

Packages

No packages published