# Ruby on Rails Guides Guidelines
This guide documents guidelines for writing Ruby on Rails Guides. This guide follows itself in a graceful loop, serving itself as an example.
After reading this guide, you will know:
* About the conventions to be used in Rails documentation.
* How to generate guides locally.
### Chapters
1. [Markdown](#markdown)
2. [Prologue](#prologue)
3. [Titles](#titles)
4. [API Documentation Guidelines](#api-documentation-guidelines)
5. [HTML Guides](#html-guides)
* [Generation](#html-guides-generation)
* [Validation](#validation)
6. [Kindle Guides](#kindle-guides)
* [Generation](#kindle-guides-generation)
### 1 Markdown
Guides are written in [GitHub Flavored Markdown](https://help.github.com/articles/github-flavored-markdown). There is comprehensive [documentation for Markdown](http://daringfireball.net/projects/markdown/syntax), a [cheatsheet](http://daringfireball.net/projects/markdown/basics).
### 2 Prologue
Each guide should start with motivational text at the top (that's the little introduction in the blue area). The prologue should tell the reader what the guide is about, and what they will learn. See for example the [Routing Guide](routing.html).
### 3 Titles
The title of every guide uses `h1`; guide sections use `h2`; subsections `h3`; etc. However, the generated HTML output will have the heading tag starting from `<h2>`.
```
Guide Title
===========
Section
-------
### Sub Section
```
Capitalize all words except for internal articles, prepositions, conjunctions, and forms of the verb to be:
```
#### Middleware Stack is an Array
#### When are Objects Saved?
```
Use the same typography as in regular text:
```
##### The `:content_type` Option
```
### 4 API Documentation Guidelines
The guides and the API should be coherent and consistent where appropriate. Please have a look at these particular sections of the [API Documentation Guidelines](api_documentation_guidelines.html):
* [Wording](api_documentation_guidelines.html#wording)
* [Example Code](api_documentation_guidelines.html#example-code)
* [Filenames](api_documentation_guidelines.html#filenames)
* [Fonts](api_documentation_guidelines.html#fonts)
Those guidelines apply also to guides.
### 5 HTML Guides
Before generating the guides, make sure that you have the latest version of Bundler installed on your system. As of this writing, you must install Bundler 1.3.5 on your device.
To install the latest version of Bundler, simply run the `gem install bundler` command
#### 5.1 Generation
To generate all the guides, just `cd` into the `guides` directory, run `bundle install` and execute:
```
bundle exec rake guides:generate
```
or
```
bundle exec rake guides:generate:html
```
To process `my_guide.md` and nothing else use the `ONLY` environment variable:
```
touch my_guide.md
bundle exec rake guides:generate ONLY=my_guide
```
By default, guides that have not been modified are not processed, so `ONLY` is rarely needed in practice.
To force processing all the guides, pass `ALL=1`.
It is also recommended that you work with `WARNINGS=1`. This detects duplicate IDs and warns about broken internal links.
If you want to generate guides in a language other than English, you can keep them in a separate directory under `source` (eg. `source/es`) and use the `GUIDES_LANGUAGE` environment variable:
```
bundle exec rake guides:generate GUIDES_LANGUAGE=es
```
If you want to see all the environment variables you can use to configure the generation script just run:
```
rake
```
#### 5.2 Validation
Please validate the generated HTML with:
```
bundle exec rake guides:validate
```
Particularly, titles get an ID generated from their content and this often leads to duplicates. Please set `WARNINGS=1` when generating guides to detect them. The warning messages suggest a solution.
### 6 Kindle Guides
#### 6.1 Generation
To generate guides for the Kindle, use the following rake task:
```
bundle exec rake guides:generate:kindle
```
### 反馈
欢迎帮忙改善指南质量。
如发现任何错误,欢迎修正。开始贡献前,可先行阅读[贡献指南:文档](http://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#contributing-to-the-rails-documentation)。
翻译如有错误,深感抱歉,欢迎 [Fork](https://github.com/ruby-china/guides/fork) 修正,或至此处[回报](https://github.com/ruby-china/guides/issues/new)。
文章可能有未完成或过时的内容。请先检查 [Edge Guides](http://edgeguides.rubyonrails.org) 来确定问题在 master 是否已经修掉了。再上 master 补上缺少的文件。内容参考 [Ruby on Rails 指南准则](ruby_on_rails_guides_guidelines.html)来了解行文风格。
最后,任何关于 Ruby on Rails 文档的讨论,欢迎到 [rubyonrails-docs 邮件群组](http://groups.google.com/group/rubyonrails-docs)。
- Ruby on Rails 指南 (651bba1)
- 入门
- Rails 入门
- 模型
- Active Record 基础
- Active Record 数据库迁移
- Active Record 数据验证
- Active Record 回调
- Active Record 关联
- Active Record 查询
- 视图
- Action View 基础
- Rails 布局和视图渲染
- 表单帮助方法
- 控制器
- Action Controller 简介
- Rails 路由全解
- 深入
- Active Support 核心扩展
- Rails 国际化 API
- Action Mailer 基础
- Active Job 基础
- Rails 程序测试指南
- Rails 安全指南
- 调试 Rails 程序
- 设置 Rails 程序
- Rails 命令行
- Rails 缓存简介
- Asset Pipeline
- 在 Rails 中使用 JavaScript
- 引擎入门
- Rails 应用的初始化过程
- Autoloading and Reloading Constants
- 扩展 Rails
- Rails 插件入门
- Rails on Rack
- 个性化Rails生成器与模板
- Rails应用模版
- 贡献 Ruby on Rails
- Contributing to Ruby on Rails
- API Documentation Guidelines
- Ruby on Rails Guides Guidelines
- Ruby on Rails 维护方针
- 发布记
- A Guide for Upgrading Ruby on Rails
- Ruby on Rails 4.2 发布记
- Ruby on Rails 4.1 发布记
- Ruby on Rails 4.0 Release Notes
- Ruby on Rails 3.2 Release Notes
- Ruby on Rails 3.1 Release Notes
- Ruby on Rails 3.0 Release Notes
- Ruby on Rails 2.3 Release Notes
- Ruby on Rails 2.2 Release Notes