# 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