doc-scripts

React Document Build Tool Scripts , Like react-scripts of create react app

MIT License

Stars
155

Features ๐Ÿฆ‘

  • ๐Ÿ›  No config
  • ๐Ÿ˜† Based on Markdown,Merge and Show all markdown files
  • ๐Ÿ‘ฉโ€๐Ÿ’ป Code Highlighting And JSX Code is Runnable
  • ๐Ÿ’ฏ Emoji Support
  • ๐Ÿ– React Props Table Support
  • โœจ Creates Static files (only JS is prism)
  • ๐Ÿณ๏ธโ€๐ŸŒˆ Pretty Pages
  • ๐Ÿฆ„ Customizable
  • ๐Ÿ‡ณ๐Ÿ‡ฑ CodeSandbox and iframe Support

Install ๐Ÿฆ…

npm install --save doc-scripts

Usage ๐ŸŒˆ

1. Node cli


doc-scripts start --input docs

doc-script build --input docs --output doc-site

2. Markdown Usage

examples

3. Javascript api


import {execute} from 'doc-scripts'

const options = {
  title:'xxxx',
  header:'<link rel="stylesheet" href="//xxxxxx">',
  footer:'<script>xxxxx</script>',
  renderer:'./doc-renderer.js',
  requires:[]
}

const webpackConfig = {
  module:{
    rules:[...]
  }
}

execute('start',options,webpackConfig) or execute('build',options,webpackConfig)

4. Webpack extended configuration

Create a new file named doc-scripts.config.js in the root directory. The following is the specific format specification.

module.exports = {
  module: {
    rules: []
  },
  plugins: []
}

//or

module.exports = function(config) {
  return {
    ...config,
    module: {
      rules: []
    },
    plugins: []
  }
}

5. Demo HTML Template extended configuration

Create a new file named doc-scripts.header.html or doc-scripts.footer.html in the root directory. The following is the specific format specification.

<!-- this is doc-scripts.header.html -->
<link rel="stylesheet" href="//unpkg.com/@alifd/next/dist/next.min.css" />

6. Customize Doc Renderer

Create a new file named doc-scripts.renderer.js in the root directory. The following is the specific format specification.


import DocRenderer from 'react-doc-renderer'

//react-doc-renderer default render engien in doc-scripts, so ,you can continue to reuse this component in doc-scripts.renderer.js, or you can completely override its behavior.

export default ({docs = []})=>(
  <div>
    <DocRenderer docs={docs}/>
  </div>
)

Contributors ๐Ÿ’ช๐Ÿป

Janry๐Ÿ“– ๐Ÿ’ป ๐Ÿ‘€ ๐Ÿค”

LICENSE

Doc scripts is open source software licensed as MIT.