Slate——为 API 生成精美的静态文档

2020-04-22  本文已影响0人  独木舟的木

原文:slate - README

Slate 可以帮助你创建美观、智能、响应迅速的 API 文档。

Screenshot of Example Documentation created with Slate

以上 API 示例文档通过 Slate 创建。你可以点击链接 slatedocs.github.io/slate 一探究竟。

特性

Slate 入门非常简单!只需 fork 此存储库即可,然后按照以下说明进行操作。或者,如果您想了解 Slate 的功能,请查看 sample docs

开始使用 Slate

先决条件

你需要:

# 当我执行以下命令安装 bundler 时,得到了权限不够的提示!
$ gem install bundler
Fetching bundler-2.1.4.gem
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.

# 解决方法:将 Bundler 安装到用户主目录下
# 参考:https://bundler.io/doc/troubleshooting.html
$ gem install bundler --user-install

开始设置

  1. 在 GitHub 上 fork 此存储库.
  2. 将你 fork 下来的存储库(不是我们原始的存储库)克隆到本地硬盘,可以执行此命令:git clone https://github.com/YOURUSERNAME/slate.git
  3. cd slate
  4. 初始化并启动 Slate。你可以在本地或通过 Vagrant 进行操作:
# 要么运行以下命令在本地运行
# 注:第一次运行这条命令会花很长时间来安装很多包文件。
# 建议首先执行以下命令配置路径,将 gems 安装到 ./vendor/bundle/ 目录下,否则系统会经常让你输入密码以获取操作权限,或者遇到没有拷贝权限以至于安装失败的问题。
$ bundle config set path 'vendor/bundle'
Your application has set path to "vendor/bundle". This will override the global value you are currently setting
$ bundle install
...
$ bundle exec middleman server

# 或者通过 vagrant 运行以下命令
vagrant up

你现在可以在 http://localhost:4567 看到文档了。 哇! 它真的很快!

现在已经在你的计算机上设置了 Slate,您可能想了解更多有关 编辑 Slate markdown 文档 或者 如何发布你的 API 文档

如果你更偏爱使用 Docker,可以阅读 wiki 中的说明。

关于JavaScript运行时的注意事项

对于那些没有 JavaScript 运行时或 ExecJS 遇到 JavaScript 运行时问题的用户,建议将 rubyracer gem 添加到你的gemfile 中,然后再次运行 bundle

使用 Slate 的公司

You can view more in the list on the wiki.

有问题? 需要帮助? 找到了一个bug?

If you've got questions about setup, deploying, special feature implementation in your fork, or just want to chat with the developer, please feel free to start a thread in our Spectrum community!

Found a bug with upstream Slate? Go ahead and submit an issue. And, of course, feel free to submit pull requests with bug fixes or changes to the dev branch.

贡献者

Slate was built by Robert Lord while interning at TripIt.

Thanks to the following people who have submitted major pull requests:

Also, thanks to Sauce Labs for sponsoring the development of the responsive styles.

特别感谢

上一篇 下一篇

猜你喜欢

热点阅读