Giter Club home page Giter Club logo

rdoc's Introduction

rdoc

Join the chat at https://gitter.im/j-rdoc/Lobby jaywcjlove/sb

Blazing-fast static site generator for React, Just write Markdown file. Visit the react-doc.github.io website for more information.

The documentation site is also a demo example.

Getting Started

It's really easy to get started with rdoc. Just install it as a module and run it to create your website.

Let's get you started!

Install

Install rdoc globally on your system. You’ll need to have Node >= 8 on your local development machine. You can use n to easily switch Node versions between different projects.

npm install rdoc -g

# /usr/local/bin/rdoc -> /usr/local/lib/node_modules/rdoc/.bin/rdoc.js
# /usr/local/bin/rdoc-cli -> /usr/local/lib/node_modules/rdoc/.bin/rdoc.js

Added rdoc-cli command to resolve Mac integration rdoc command conflicts.

  1. Init Project
rdoc init my-project  # Init project
# or
rdoc-cli init my-project 
  1. Run website
cd my-project && npm install # Install dependencies.
npm start # Into the directory, start the service.
  1. Compile output static HTML resources
npm run build
  1. Configure the deployment URL in package.json
{
  "scripts": {
    "deploy": "rdoc --publish <your repo url>"
    ...
  },
  ...
}
  1. Deploy to Github's gh-pages branch
npm run deploy

Command

Usage: rdoc [options]

Fast static site generator for React.

Options:

  -i, init [path]        Create an empty website or reinitialize an existing one.
  -d, --doc <path>       Other documents generated.
  -o, --output <path>    Writes the compiled file to the disk directory. (default: .rdoc-dist)
  -p, --port [number]    The port. (default: 5858)
  --host [host]      The host. (default: 0.0.0.0)
  -b, --branch <branch>  Name of the branch you are pushing to. (default: gh-pages)
  --publish [url]        Other documents generated.
  --build                Creating an optimized production build.
  --clean                Delete the .cache folder.
  -h, --help             output usage information

Examples:

  $ rdoc init
  $ rdoc init doc-example
  $ rdoc -d doc/mm
  $ rdoc -d tutorial,doc
  $ rdoc -d tutorial,doc --clean --build
  $ rdoc -p 2323  -d doc --clean
  $ rdoc --host 0.0.0.0 -d doc --clean
  $ rdoc --publish https://<your-git-repo>.git --branch master

Development

To develop, run the self-reloading build, Get the code:

$ git clone https://github.com/jaywcjlove/rdoc.git
$ cd rdoc     # Into the directory
$ npm install # or  yarn install

To develop, run the self-reloading build:

# Run the app
# Restart the app automatically every time code changes. 
# Useful during development.
$ npm run start

Open your browser and visit http://localhost:5858

Folders

.
├── README.md
├── .rdoc-dist
├── package.json
├── src
│   ├── build.js
│   ├── commands
│   ├── conf
│   ├── publish.js
│   ├── server.js
│   ├── utils
│   └── web
├── templates
│   └── default # document the static file.
└── theme
    └── default

License

The MIT License (MIT)

rdoc's People

Contributors

gitter-badger avatar jaywcjlove avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rdoc's Issues

【功能】侧边栏及树形导航支持折叠收起

hi:
感觉RDOC非常不错,可以用来写接口文档和博客。但是在内容比较多时希望左侧的树形菜单支持折叠收起功能,全部展示出来显示不完且优点杂乱。另外就是侧边栏如果能够支持整体收起隐藏就更好了。

init project error in windows

C:\Users\Administrator\AppData\Roaming\npm\node_modules\rdoc\node_modules\create
-spare-webpack-plugin\index.js:26
const { dir, ...otherOtions } = directoryTrees;
^^^

SyntaxError: Unexpected token ...
at createScript (vm.js:74:10)
at Object.runInThisContext (vm.js:116:10)
at Module._compile (module.js:533:28)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object. (C:\Users\Administrator\AppData\Roaming\npm\node_modul
es\rdoc\src\conf\webpack.config.dev.js:7:34)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Module.require (module.js:513:17)

运行 start 的时候出错

TypeError: $export is not a function

  - index.html:1880 Object../node_modules/core-js/library/modules/es6.object.define-property.js
    [blog]/[rdoc]/theme/default/index.html:1880:1

  - index.html:639 __webpack_require__
    [blog]/[rdoc]/theme/default/index.html:639:30

  - index.html:49 fn
    [blog]/[rdoc]/theme/default/index.html:49:20

  - index.html:894 Object../node_modules/core-js/library/fn/object/define-property.js
    [blog]/[rdoc]/theme/default/index.html:894:1

  - index.html:639 __webpack_require__
    [blog]/[rdoc]/theme/default/index.html:639:30

  - index.html:49 fn
    [blog]/[rdoc]/theme/default/index.html:49:20

  - index.html:725 Object../node_modules/babel-runtime/core-js/object/define-property.js
    [blog]/[rdoc]/theme/default/index.html:725:27

  - index.html:639 __webpack_require__
    [blog]/[rdoc]/theme/default/index.html:639:30

  - index.html:49 fn
    [blog]/[rdoc]/theme/default/index.html:49:20

  - index.html:1462 Object../node_modules/core-js/library/modules/_object-dp.js
    [blog]/[rdoc]/theme/default/index.html:1462:21

  - From previous event:

  - index.js:110 Compiler.<anonymous>
    [blog]/[html-webpack-plugin]/index.js:110:8

  - Tapable.js:206 Compiler.applyPluginsAsyncSeries
    [blog]/[tapable]/lib/Tapable.js:206:13

  - Compiler.js:354 Compiler.emitAssets
    [blog]/[webpack]/lib/Compiler.js:354:8

  - Compiler.js:58 onCompiled
    [blog]/[webpack]/lib/Compiler.js:58:19

  - Compiler.js:510 applyPluginsAsync.err
    [blog]/[webpack]/lib/Compiler.js:510:14

  - Tapable.js:202 next
    [blog]/[tapable]/lib/Tapable.js:202:11

  - CachePlugin.js:78 Compiler.<anonymous>
    [blog]/[webpack]/lib/CachePlugin.js:78:5

  - Tapable.js:204 next
    [blog]/[tapable]/lib/Tapable.js:204:14

  - index.js:46 Compiler.compiler.plugin
    [blog]/[create-spare-webpack-plugin]/index.js:46:7

  - Tapable.js:206 Compiler.applyPluginsAsyncSeries
    [blog]/[tapable]/lib/Tapable.js:206:13

  - Compiler.js:507 compilation.seal.err
    [blog]/[webpack]/lib/Compiler.js:507:11

  - Tapable.js:195 Compilation.applyPluginsAsyncSeries
    [blog]/[tapable]/lib/Tapable.js:195:46

  - Compilation.js:677 applyPluginsAsync.err
    [blog]/[webpack]/lib/Compilation.js:677:19

  - Tapable.js:195 Compilation.applyPluginsAsyncSeries
    [blog]/[tapable]/lib/Tapable.js:195:46

  - Compilation.js:668 applyPluginsAsync.err
    [blog]/[webpack]/lib/Compilation.js:668:11

  - Tapable.js:195 Compilation.applyPluginsAsyncSeries
    [blog]/[tapable]/lib/Tapable.js:195:46

  - Compilation.js:663 applyPluginsAsync.err
    [blog]/[webpack]/lib/Compilation.js:663:10

  - Tapable.js:195 Compilation.applyPluginsAsyncSeries
    [blog]/[tapable]/lib/Tapable.js:195:46

  - Compilation.js:659 applyPluginsAsyncSeries
    [blog]/[webpack]/lib/Compilation.js:659:9

  - From previous event:

  - index.js:55 Compiler.<anonymous>
    [blog]/[html-webpack-plugin]/index.js:55:8

  - Tapable.js:293 Compiler.applyPluginsParallel
    [blog]/[tapable]/lib/Tapable.js:293:14

  - Compiler.js:499 applyPluginsAsync.err
    [blog]/[webpack]/lib/Compiler.js:499:9

  - Tapable.js:195 Compiler.applyPluginsAsyncSeries
    [blog]/[tapable]/lib/Tapable.js:195:46

  - Compiler.js:492 Compiler.compile
    [blog]/[webpack]/lib/Compiler.js:492:8

  - Compiler.js:83 compiler.applyPluginsAsync.err
    [blog]/[webpack]/lib/Compiler.js:83:18

  - Tapable.js:202 next
    [blog]/[tapable]/lib/Tapable.js:202:11

  - Shared.js:161 Compiler.compilerInvalid
    [blog]/[webpack-dev-middleware]/lib/Shared.js:161:5

  - Tapable.js:204 next
    [blog]/[tapable]/lib/Tapable.js:204:14

  - CachePlugin.js:48 Compiler.compiler.plugin
    [blog]/[webpack]/lib/CachePlugin.js:48:5

  - Tapable.js:206 Compiler.applyPluginsAsyncSeries
    [blog]/[tapable]/lib/Tapable.js:206:13

  - Compiler.js:48 Watching._go
    [blog]/[webpack]/lib/Compiler.js:48:17

  - Compiler.js:142 Watching.invalidate
    [blog]/[webpack]/lib/Compiler.js:142:9

  - Compiler.js:123 watcher.compiler.watchFileSystem.watch
    [blog]/[webpack]/lib/Compiler.js:123:9

  - NodeWatchFileSystem.js:45 Watchpack.watcher.once
    [blog]/[webpack]/lib/node/NodeWatchFileSystem.js:45:4

  - watchpack.js:142 Watchpack._onTimeout
    [blog]/[watchpack]/lib/watchpack.js:142:7

关于目前在用的几个问题

  1. 版权更换,版权修改能不能像更新icon的方式一样设置简单一些,我看您说可以通过更换主题的方式修改,但是这个对于非react的专业学员来说操作确实麻烦了一点。
  2. 虽然是doc,但是目前手机端的流量也蛮大,我发现目前对于手机端的适配比较不友好,请问是否有计划对手机端的显示做一些优化,目前使用iPhone发现竖屏的情况下,左侧的导航栏占据了一大部分的屏幕,右边的doc内容被压缩得很窄,读起来很费劲。

感谢倾听,望回复!

in windows

C:\Users\wellorange\Desktop\document\my-project\node_modules\create-spare-webpack-plugin\index.js:36
filePathItem = filePathItem.replace(process.cwd() + PATH.sep, '').replace(new RegExp(PATH.sep, 'g'), sep);
^

SyntaxError: Invalid regular expression: //: \ at end of pattern
at new RegExp ()
at filemds.forEach (C:\Users\wellorange\Desktop\document\my-project\node_modules\create-spare-webpack-plugin\index.js:36:85)
at Array.forEach ()
at Compiler.compiler.plugin (C:\Users\wellorange\Desktop\document\my-project\node_modules\create-spare-webpack-plugin\index.js:33:15)
at Compiler.applyPluginsAsyncSeries (C:\Users\wellorange\Desktop\document\my-project\node_modules\tapable\lib\Tapable.js:206:13)
at compilation.seal.err (C:\Users\wellorange\Desktop\document\my-project\node_modules\webpack\lib\Compiler.js:507:11)
at Compilation.applyPluginsAsyncSeries (C:\Users\wellorange\Desktop\document\my-project\node_modules\tapable\lib\Tapable.js:195:46)
at self.applyPluginsAsync.err (C:\Users\wellorange\Desktop\document\my-project\node_modules\webpack\lib\Compilation.js:680:19)
at Compilation.applyPluginsAsyncSeries (C:\Users\wellorange\Desktop\document\my-project\node_modules\tapable\lib\Tapable.js:195:46)
at self.applyPluginsAsync.err (C:\Users\wellorange\Desktop\document\my-project\node_modules\webpack\lib\Compilation.js:671:11)
at Compilation.applyPluginsAsyncSeries (C:\Users\wellorange\Desktop\document\my-project\node_modules\tapable\lib\Tapable.js:195:46)
at self.applyPluginsAsync.err (C:\Users\wellorange\Desktop\document\my-project\node_modules\webpack\lib\Compilation.js:666:10)
at Compilation.applyPluginsAsyncSeries (C:\Users\wellorange\Desktop\document\my-project\node_modules\tapable\lib\Tapable.js:195:46)
at sealPart2 (C:\Users\wellorange\Desktop\document\my-project\node_modules\webpack\lib\Compilation.js:662:9)
at Compilation.applyPluginsAsyncSeries (C:\Users\wellorange\Desktop\document\my-project\node_modules\tapable\lib\Tapable.js:195:46)
at Compilation.seal (C:\Users\wellorange\Desktop\document\my-project\node_modules\webpack\lib\Compilation.js:605:8)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: rdoc -d home,introduce,faq,about,github --clean
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\wellorange\AppData\Roaming\npm-cache_logs\2018-01-22T03_18_06_238Z-debug.log

C:\Users\wellorange\Desktop\document\my-project>

Module not found: Can't resolve './indexLayout.less'

我的运行环境
inux 4.14.0-deepin2-amd64 #1 SMP PREEMPT Deepin 4.14.12-2 (2018-01-06) x86_64 GNU/Linux
node 9.8.0

rdoc -d about

/usr/local/lib/node_modules/rdoc/theme/default/layout/IndexLayout.js
Module not found: Can't resolve './indexLayout.less' in '/usr/local/lib/node_modules/rdoc/theme/default/layout

npm start

Module not found: Can't resolve './indexLayout.less' in '/media/oeli/doc/node_modules/rdoc/theme/default/layout'

Html Webpack Plugin:
TypeError: $export is not a function

  • index.html:1880 Object../node_modules/core-js/library/modules/es6.object.define-property.js
    [spiderdoc]/[rdoc]/theme/default/index.html:1880:1

  • index.html:639 webpack_require
    [spiderdoc]/[rdoc]/theme/default/index.html:639:30

  • index.html:49 fn
    [spiderdoc]/[rdoc]/theme/default/index.html:49:20

  • index.html:894 Object../node_modules/core-js/library/fn/object/define-property.js
    [spiderdoc]/[rdoc]/theme/default/index.html:894:1

  • index.html:639 webpack_require
    [spiderdoc]/[rdoc]/theme/default/index.html:639:30

  • index.html:49 fn
    [spiderdoc]/[rdoc]/theme/default/index.html:49:20

  • index.html:725 Object../node_modules/babel-runtime/core-js/object/define-property.js
    [spiderdoc]/[rdoc]/theme/default/index.html:725:27

  • index.html:639 webpack_require
    [spiderdoc]/[rdoc]/theme/default/index.html:639:30

  • index.html:49 fn
    [spiderdoc]/[rdoc]/theme/default/index.html:49:20

  • index.html:1462 Object../node_modules/core-js/library/modules/_object-dp.js
    [spiderdoc]/[rdoc]/theme/default/index.html:1462:21

  • From previous event:

  • index.js:110 Compiler.
    [spiderdoc]/[html-webpack-plugin]/index.js:110:8

  • Tapable.js:206 Compiler.applyPluginsAsyncSeries
    [spiderdoc]/[tapable]/lib/Tapable.js:206:13

  • Compiler.js:354 Compiler.emitAssets
    [spiderdoc]/[webpack]/lib/Compiler.js:354:8

  • Compiler.js:58 onCompiled
    [spiderdoc]/[webpack]/lib/Compiler.js:58:19

  • Compiler.js:510 applyPluginsAsync.err
    [spiderdoc]/[webpack]/lib/Compiler.js:510:14

  • Tapable.js:202 next
    [spiderdoc]/[tapable]/lib/Tapable.js:202:11

  • CachePlugin.js:78 Compiler.
    [spiderdoc]/[webpack]/lib/CachePlugin.js:78:5

  • Tapable.js:204 next
    [spiderdoc]/[tapable]/lib/Tapable.js:204:14

  • index.js:46 Compiler.compiler.plugin
    [spiderdoc]/[create-spare-webpack-plugin]/index.js:46:7

  • Tapable.js:206 Compiler.applyPluginsAsyncSeries
    [spiderdoc]/[tapable]/lib/Tapable.js:206:13

  • Compiler.js:507 compilation.seal.err
    [spiderdoc]/[webpack]/lib/Compiler.js:507:11

  • Tapable.js:195 Compilation.applyPluginsAsyncSeries
    [spiderdoc]/[tapable]/lib/Tapable.js:195:46

  • Compilation.js:677 applyPluginsAsync.err
    [spiderdoc]/[webpack]/lib/Compilation.js:677:19

  • Tapable.js:195 Compilation.applyPluginsAsyncSeries
    [spiderdoc]/[tapable]/lib/Tapable.js:195:46

  • Compilation.js:668 applyPluginsAsync.err
    [spiderdoc]/[webpack]/lib/Compilation.js:668:11

  • Tapable.js:195 Compilation.applyPluginsAsyncSeries
    [spiderdoc]/[tapable]/lib/Tapable.js:195:46

  • Compilation.js:663 applyPluginsAsync.err
    [spiderdoc]/[webpack]/lib/Compilation.js:663:10

  • Tapable.js:195 Compilation.applyPluginsAsyncSeries
    [spiderdoc]/[tapable]/lib/Tapable.js:195:46

  • Compilation.js:659 applyPluginsAsyncSeries
    [spiderdoc]/[webpack]/lib/Compilation.js:659:9

npm run build uglify报错

ERROR in js/vendor.28c0ef80.js from UglifyJs
Unexpected token: keyword «const» [./node_modules/@babel/polyfill/lib/index.js:6,0][js/vendor.28c0ef80.js:12996,2]
image
image

也许 src/conf/path.js -> getExcludeFoldersRegExp 需要改一下。

router.js 报错

C:/Users/Administrator/AppData/Roaming/npm/node_modules/rdoc/src/web/Router.js
Module parse failed: Unexpected token (12:43)
You may need an appropriate loader to handle this file type.
|   if (!arr || arr.length === 0) return false;
|   const index = arr.filter(item => item.name === 'README.md' && item.mdconf);
|   if (index && index.length > 0) props = { ...index[0] };
|   return props;
| }

解析出错

运行 rdoc init my-project 时,程序为什么会解析我的本地文件?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.