Description
I think it might be useful to have a guide for style, formatting, and what should and should not be included. If there is, care should be taken to communicate that they are guidelines on how documentation should be written, not necessarily how it must be written, since overly pedantic rules can discourage contribution.
Policy
-
When should the reference include why something is done in a particular way? Often the reference avoids the "why", but I think it can sometimes provide interesting context.
- For example,
type_length_limit
explains what it does, but not why it is there. I think it could be useful to say something like:type_length_limit
is used to prevent the compiler from hanging and to better deal with polymorphic recursion. - There are many other examples where the motivation for something is hidden away in some RFC.
- For example,
-
How can reference writers know when something should be intentionally undefined? (Like certain evaluation orders.) Seems like it would be easy to accidentally document some behavior without knowing it shouldn't be specified. Maybe someone in-the-know could call out exactly what should be left undefined, I suspect the list is not very long.
-
How to deal with rustc version numbers? Is the rustc version number the same as the "The Rust Language" version number? Should the reference actively avoid mentioning version numbers? In general, they could be useful in some situations, but generally are difficult to mark what is changed/added/removed with enough granularity, and to deal with changes over time. (See Should we document when features are stabilized? #60)
-
Should the reference document actual rust behavior (including bugs)? Or should it document the intended behavior? Or both?
- Related: If there's a known issue, should it be encouraged or discouraged to link to the Github issue?
-
Should the reference mention things that are deprecated?
-
Should the reference avoid talking about past behavior?
-
How should overlap with other documentation be handled? Should the reference duplicate everything and be completely standalone? Or can it link to other books?
- It could be useful to link to other sources like TRPL. The reference is tends to be terse, and pointing to guide-style documentation could helpful for someone learning how to use something. However, lots of links would be very noisy.
-
How should the reference handle
rustc
-specific things? Where does the line get drawn? What is OK to mention? For example, compiler flags? Should it just be opportunistically helpful? For example,extern crate
briefly mentions Cargo's dash-to-underscore rename. Another example: is the filesystem layout part of the language or part of the implementation? What is implementation-specific? -
What is the policy for linking to historical information, such as RFCs, PRs, GitHub issues, blog posts, etc? These sources are mostly static and not updated, and thus may provide outdated or incorrect information. However, as historical context they are useful.
-
Should examples be encouraged? Any guidelines for writing examples?
- naming convention (is foo/bar/baz ok? or should it lean towards realistic examples?)
- Balancing length vs. clarity.
- Usage of
no_run
orignore
. - Realistic examples vs trivial examples of code nobody would ever write.
-
Guidelines for documenting lints. Generally I think they are always avoided, that's what the rustc book is for.
-
Should the reference be agnostic about whether code is "compiled" or "interpreted"? Should it avoid using the term "compile"?
Style
- Spelling (british vs american)
- Should CI check spelling? TRPL has a spell script with a pre-defined dictionary.txt.
- Should there be recommended English grammar guidelines? AP Style? etc.
- Grammatic person guidelines? Voice?
- Various things to avoid?
- Avoid "in Rust", everything in the reference is about Rust.
- Avoid foo/bar slashes, use "and" or commas.
- Any guidance on contractions?
- Is
E
in "2018 Edition" capitalized? - Explain or define the "style" of the reference. i.e. it is not a "guide". It expresses how things work and behave, not how to use them.
- The prose should probably not repeat the grammar rules. i.e. don't say "an expression followed by an equals sign (
=
) followed by an expression".
Formatting
- Word wrapping column? 80? 90? 100? No wrapping? No preference? Semantic linefeeds?
- Should PR's avoid re-wrapping paragraphs to make the diff easier to read, or should they always re-wrap everything?
- Where should Markdown links be placed? Inline, below a section, bottom of file, etc? Should links be alphabetized? Case-sensitive or not?
- Avoid indenting links for alignment?
- List and document special constructs like "warning", "note", "edition differences" and when to use them. (Formatting for notes is currently inconsistent.)
- Preferred styling for lists
-
or*
or anything? - Preferred heading format is ATX style?
- Headings should be sentence case? Or Initial Caps?
- Avoid double blank lines (only one blank line between sections)
Links of interest
- https://github.com/rust-lang/book/blob/master/style-guide.md
- https://developers.google.com/style/
- https://docs.microsoft.com/en-us/style-guide/welcome/
- https://github.com/cplusplus/draft/wiki/Specification-Style-Guidelines
- https://github.com/jenniferlynparsons/awesome-writing
- https://www.iso.org/files/live/sites/isoorg/files/archive/pdf/en/how-to-write-standards.pdf